@@ -37,7 +37,7 @@ class WebDriver(RemoteWebDriver):
37
37
# There is no native event support on Mac
38
38
NATIVE_EVENTS_ALLOWED = sys .platform != "darwin"
39
39
40
- def __init__ (self , firefox_profile = None , firefox_binary = '/Users/dburns/development/mozilla/mozilla-inbound/obj-ff-dbg/dist/Nightly.app/Contents/MacOS/firefox' , timeout = 30 ,
40
+ def __init__ (self , firefox_profile = None , firefox_binary = None , timeout = 30 ,
41
41
capabilities = None , proxy = None , executable_path = 'wires' ):
42
42
43
43
self .binary = firefox_binary
@@ -49,22 +49,36 @@ def __init__(self, firefox_profile=None, firefox_binary='/Users/dburns/developme
49
49
self .profile .native_events_enabled = (
50
50
self .NATIVE_EVENTS_ALLOWED and self .profile .native_events_enabled )
51
51
52
- if self .binary is None :
53
- self .binary = FirefoxBinary ()
54
-
55
52
if capabilities is None :
56
53
capabilities = DesiredCapabilities .FIREFOX
57
54
58
- if proxy is not None :
59
- proxy .add_to_capabilities (capabilities )
60
-
61
- self .service = Service (executable_path , firefox_binary = self .binary )
62
- self .service .start ()
63
-
64
- RemoteWebDriver .__init__ (self ,
65
- command_executor = self .service .service_url ,
55
+ if "marionette" in capabilities and capabilities ['marionette' ] is True :
56
+ # Let's use Marionette! WOOOOHOOOOO!
57
+ if "binary" in capabilities :
58
+ self .binary = capabilities ["binary" ]
59
+ self .service = Service (executable_path , firefox_binary = self .binary )
60
+ self .service .start ()
61
+
62
+ RemoteWebDriver .__init__ (self ,
63
+ command_executor = self .service .service_url ,
64
+ desired_capabilities = capabilities ,
65
+ keep_alive = True )
66
+
67
+ else :
68
+ # Oh well... sometimes the old way is the best way.
69
+ if self .binary is None :
70
+ self .binary = FirefoxBinary ()
71
+
72
+ if proxy is not None :
73
+ proxy .add_to_capabilities (capabilities )
74
+
75
+ RemoteWebDriver .__init__ (self ,
76
+ command_executor = ExtensionConnection ("127.0.0.1" , self .profile ,
77
+ self .binary , timeout ),
66
78
desired_capabilities = capabilities ,
67
79
keep_alive = True )
80
+
81
+
68
82
self ._is_remote = False
69
83
70
84
def quit (self ):
0 commit comments