1818import warnings
1919
2020from selenium .webdriver .chrome .options import Options as ChromeOptions
21- from selenium .webdriver .chromium .remote_connection import ChromiumRemoteConnection
2221from selenium .webdriver .common .options import BaseOptions
2322from selenium .webdriver .common .service import Service
2423from selenium .webdriver .edge .options import Options as EdgeOptions
24+ from selenium .webdriver .remote .client_config import ClientConfig
2525from selenium .webdriver .remote .webdriver import WebDriver as RemoteWebDriver
2626
2727DEFAULT_PORT = 0
2828DEFAULT_SERVICE_LOG_PATH = None
29- DEFAULT_KEEP_ALIVE = None
3029
3130
3231class ChromiumDriver (RemoteWebDriver ):
@@ -43,7 +42,8 @@ def __init__(
4342 desired_capabilities = None ,
4443 service_log_path = DEFAULT_SERVICE_LOG_PATH ,
4544 service : Service = None ,
46- keep_alive = DEFAULT_KEEP_ALIVE ,
45+ keep_alive = None ,
46+ client_config : ClientConfig = ClientConfig (),
4747 ) -> None :
4848 """Creates a new WebDriver instance of the ChromiumDriver. Starts the
4949 service and then creates new WebDriver instance of ChromiumDriver.
@@ -74,34 +74,29 @@ def __init__(
7474 DeprecationWarning ,
7575 stacklevel = 2 ,
7676 )
77- if keep_alive != DEFAULT_KEEP_ALIVE and type (self ) == __class__ :
78- warnings .warn (
79- "keep_alive has been deprecated, please pass in a Service object" , DeprecationWarning , stacklevel = 2
80- )
81- else :
82- keep_alive = True
8377
8478 self .vendor_prefix = vendor_prefix
8579
86- _ignore_proxy = None
8780 if not options :
8881 options = self .create_options ()
8982
9083 if desired_capabilities :
9184 for key , value in desired_capabilities .items ():
9285 options .set_capability (key , value )
9386
94- if options ._ignore_local_proxy :
95- _ignore_proxy = options ._ignore_local_proxy
96-
9787 if not service :
9888 raise AttributeError ("service cannot be None" )
9989
10090 self .service = service
10191 self .service .start ()
10292
10393 try :
104- super ().__init__ (command_executor = self .service .service_url , options = options , keep_alive = keep_alive ,)
94+ super ().__init__ (
95+ command_executor = self .service .service_url ,
96+ options = options ,
97+ keep_alive = keep_alive ,
98+ client_config = client_config ,
99+ )
105100 except Exception :
106101 self .quit ()
107102 raise
0 commit comments