@@ -47,38 +47,22 @@ class WebDriver(RemoteWebDriver):
47
47
48
48
def __init__ (self , firefox_profile = None , firefox_binary = None , timeout = 30 ,
49
49
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 ()
53
51
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 )
56
55
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 ())
59
57
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 ())
74
62
75
63
# marionette
76
64
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 )
82
66
self .service .start ()
83
67
84
68
executor = FirefoxRemoteConnection (
@@ -93,12 +77,6 @@ def __init__(self, firefox_profile=None, firefox_binary=None, timeout=30,
93
77
if proxy is not None :
94
78
proxy .add_to_capabilities (capabilities )
95
79
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
-
102
80
executor = ExtensionConnection ("127.0.0.1" , self .profile ,
103
81
self .binary , timeout )
104
82
RemoteWebDriver .__init__ (self ,
0 commit comments