@@ -130,16 +130,18 @@ def __init__(self, command_executor='http://127.0.0.1:4444/wd/hub',
130
130
then default LocalFileDetector() will be used.
131
131
- options - instance of a driver options.Options class
132
132
"""
133
- if desired_capabilities is None :
134
- raise WebDriverException ("Desired Capabilities can't be None" )
135
- if not isinstance (desired_capabilities , dict ):
136
- raise WebDriverException ("Desired Capabilities must be a dictionary" )
133
+ capabilities = {}
134
+ if options is not None :
135
+ capabilities = options .to_capabilities ()
136
+ if desired_capabilities is not None :
137
+ if not isinstance (desired_capabilities , dict ):
138
+ raise WebDriverException ("Desired Capabilities must be a dictionary" )
139
+ else :
140
+ capabilities .update (desired_capabilities )
137
141
if proxy is not None :
138
142
warnings .warn ("Please use FirefoxOptions to set proxy" ,
139
143
DeprecationWarning )
140
- proxy .add_to_capabilities (desired_capabilities )
141
- if options is not None :
142
- desired_capabilities .update (options .to_capabilities ())
144
+ proxy .add_to_capabilities (capabilities )
143
145
self .command_executor = command_executor
144
146
if type (self .command_executor ) is bytes or isinstance (self .command_executor , str ):
145
147
self .command_executor = RemoteConnection (command_executor , keep_alive = keep_alive )
@@ -151,7 +153,7 @@ def __init__(self, command_executor='http://127.0.0.1:4444/wd/hub',
151
153
if browser_profile is not None :
152
154
warnings .warn ("Please use FirefoxOptions to set browser profile" ,
153
155
DeprecationWarning )
154
- self .start_session (desired_capabilities , browser_profile )
156
+ self .start_session (capabilities , browser_profile )
155
157
self ._switch_to = SwitchTo (self )
156
158
self ._mobile = Mobile (self )
157
159
self .file_detector = file_detector or LocalFileDetector ()
0 commit comments