4545 WebDriverException ,
4646 NoSuchCookieException )
4747from selenium .webdriver .common .by import By
48+ from selenium .webdriver .common .options import BaseOptions
4849from selenium .webdriver .common .timeouts import Timeouts
4950from selenium .webdriver .common .html5 .application_cache import ApplicationCache
5051from selenium .webdriver .support .relative_locator import RelativeBy
@@ -146,7 +147,7 @@ class WebDriver(BaseWebDriver):
146147
147148 def __init__ (self , command_executor = 'http://127.0.0.1:4444' ,
148149 desired_capabilities = None , browser_profile = None , proxy = None ,
149- keep_alive = True , file_detector = None , options = None ):
150+ keep_alive = True , file_detector = None , options : BaseOptions = None ):
150151 """
151152 Create a new driver that will issue commands using the wire protocol.
152153
@@ -165,6 +166,30 @@ def __init__(self, command_executor='http://127.0.0.1:4444',
165166 then default LocalFileDetector() will be used.
166167 - options - instance of a driver options.Options class
167168 """
169+ if desired_capabilities :
170+ warnings .warn (
171+ "desired_capabilities has been deprecated, please pass in an Options object with options kwarg" ,
172+ DeprecationWarning ,
173+ stacklevel = 2
174+ )
175+ if browser_profile :
176+ warnings .warn (
177+ "browser_profile has been deprecated, please pass in an Firefox Options object with options kwarg" ,
178+ DeprecationWarning ,
179+ stacklevel = 2
180+ )
181+ if proxy :
182+ warnings .warn (
183+ "proxy has been deprecated, please pass in an Options object with options kwarg" ,
184+ DeprecationWarning ,
185+ stacklevel = 2
186+ )
187+ if not keep_alive :
188+ warnings .warn (
189+ "keep_alive has been deprecated. We will be using True as the default value as we start removing it." ,
190+ DeprecationWarning ,
191+ stacklevel = 2
192+ )
168193 capabilities = {}
169194 _ignore_local_proxy = False
170195 if options :
0 commit comments