@@ -47,38 +47,22 @@ class WebDriver(RemoteWebDriver):
4747
4848 def __init__ (self , firefox_profile = None , firefox_binary = None , timeout = 30 ,
4949 capabilities = None , proxy = None , executable_path = "wires" , firefox_options = None ):
50- self .profile = firefox_profile
51- self .binary = firefox_binary
52- if firefox_options is None :
50+ capabilities = capabilities or DesiredCapabilities .FIREFOX .copy ()
5351
54- if self .profile is None :
55- self .profile = FirefoxProfile ()
52+ self .profile = firefox_profile or FirefoxProfile ()
53+ self .profile .native_events_enabled = (
54+ self .NATIVE_EVENTS_ALLOWED and self .profile .native_events_enabled )
5655
57- self .profile .native_events_enabled = (
58- self .NATIVE_EVENTS_ALLOWED and self .profile .native_events_enabled )
56+ self .binary = firefox_binary or capabilities .get ("binary" , FirefoxBinary ())
5957
60- if capabilities is None :
61- capabilities = DesiredCapabilities .FIREFOX
62-
63- if self .binary is None :
64- self .binary = capabilities .get ("binary" ) or FirefoxBinary ()
65-
66- firefox_options = Options ()
67- firefox_options .binary_location = self .binary if isinstance (self .binary , basestring ) else self .binary ._get_firefox_start_cmd ()
68- firefox_options .profile = self .profile
69-
70- if capabilities is None :
71- capabilities = firefox_options .to_capabilities ()
72- else :
73- capabilities .update (firefox_options .to_capabilities ())
58+ self .options = firefox_options or Options ()
59+ self .options .binary_location = self .binary if isinstance (self .binary , basestring ) else self .binary ._get_firefox_start_cmd ()
60+ self .options .profile = self .profile
61+ capabilities .update (self .options .to_capabilities ())
7462
7563 # marionette
7664 if capabilities .get ("marionette" ):
77- self .binary = firefox_options .binary_location
78- if isinstance (firefox_options .binary_location , FirefoxBinary ):
79- self .binary = firefox_options .binary_location ._get_firefox_start_cmd ()
80-
81- self .service = Service (executable_path , firefox_binary = self .binary )
65+ self .service = Service (executable_path , firefox_binary = self .options .binary_location )
8266 self .service .start ()
8367
8468 executor = FirefoxRemoteConnection (
@@ -93,12 +77,6 @@ def __init__(self, firefox_profile=None, firefox_binary=None, timeout=30,
9377 if proxy is not None :
9478 proxy .add_to_capabilities (capabilities )
9579
96- if self .binary is None :
97- self .binary = firefox_options .binary_location or FirefoxBinary ()
98-
99- if self .profile is None :
100- self .profile = firefox_options .profile or FirefoxProfile ()
101-
10280 executor = ExtensionConnection ("127.0.0.1" , self .profile ,
10381 self .binary , timeout )
10482 RemoteWebDriver .__init__ (self ,
0 commit comments