2222 WebDriverException ,
2323)
2424from selenium .webdriver .common .by import By
25- from selenium .webdriver .remote .client_config import ClientConfig
2625from selenium .webdriver .remote .command import Command as RemoteCommand
2726from selenium .webdriver .remote .remote_connection import RemoteConnection
2827from typing_extensions import Self
3231from appium .webdriver .common .appiumby import AppiumBy
3332
3433from .appium_connection import AppiumConnection
34+ from .client_config import AppiumClientConfg
3535from .errorhandler import MobileErrorHandler
3636from .extensions .action_helpers import ActionHelpers
3737from .extensions .android .activities import Activities
@@ -205,24 +205,16 @@ class WebDriver(
205205 def __init__ ( # noqa: PLR0913
206206 self ,
207207 command_executor : Union [str , AppiumConnection ] = 'http://127.0.0.1:4444/wd/hub' ,
208- keep_alive : bool = True ,
209- direct_connection : bool = True ,
210208 extensions : Optional [List ['WebDriver' ]] = None ,
211- strict_ssl : bool = True ,
212209 options : Union [AppiumOptions , List [AppiumOptions ], None ] = None ,
213- client_config : Optional [ClientConfig ] = None ,
210+ client_config : Optional [AppiumClientConfg ] = None ,
214211 ):
212+ if client_config is None :
213+ # TODO: when command_executor is not string
214+ client_config = client_config or AppiumClientConfg (remote_server_addr = command_executor )
215+
215216 if isinstance (command_executor , str ):
216- client_config = client_config or ClientConfig (
217- remote_server_addr = command_executor , keep_alive = keep_alive , ignore_certificates = not strict_ssl
218- )
219- client_config .remote_server_addr = command_executor
220217 command_executor = AppiumConnection (remote_server_addr = command_executor , client_config = client_config )
221- elif isinstance (command_executor , AppiumConnection ) and strict_ssl is False :
222- logger .warning (
223- "Please set 'ignore_certificates' in the given 'appium.webdriver.appium_connection.AppiumConnection' or "
224- "'selenium.webdriver.remote.client_config.ClientConfig' instead. Ignoring."
225- )
226218
227219 super ().__init__ (
228220 command_executor = command_executor ,
@@ -237,8 +229,8 @@ def __init__( # noqa: PLR0913
237229
238230 self .error_handler = MobileErrorHandler ()
239231
240- if direct_connection :
241- self ._update_command_executor (keep_alive = keep_alive )
232+ if client_config . direct_connection :
233+ self ._update_command_executor (keep_alive = client_config . keep_alive )
242234
243235 # add new method to the `find_by_*` pantheon
244236 By .IOS_PREDICATE = AppiumBy .IOS_PREDICATE
0 commit comments