File tree Expand file tree Collapse file tree 3 files changed +34
-11
lines changed
lib/selenium/webdriver/firefox
spec/integration/selenium/webdriver/firefox Expand file tree Collapse file tree 3 files changed +34
-11
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ def initialize(opts = {})
32
32
33
33
caps = opts . delete ( :desired_capabilities ) { Remote ::Capabilities . firefox }
34
34
35
+ Binary . path = caps [ :firefox_binary ] if caps [ :firefox_binary ]
36
+
35
37
@launcher = create_launcher ( port , profile )
36
38
37
39
unless opts . empty?
Original file line number Diff line number Diff line change @@ -27,9 +27,17 @@ class W3CBridge < Remote::W3CBridge
27
27
def initialize ( opts = { } )
28
28
http_client = opts . delete ( :http_client )
29
29
30
+ opts . delete ( :marionette )
31
+ caps = opts . delete ( :desired_capabilities ) { Remote ::W3CCapabilities . firefox }
32
+
30
33
if opts . has_key? ( :url )
31
34
url = opts . delete ( :url )
32
35
else
36
+ Binary . path = caps [ :firefox_binary ] if caps [ :firefox_binary ]
37
+ if Firefox ::Binary . version < 43
38
+ raise ArgumentError , "Firefox Version #{ Firefox ::Binary . version } does not support Marionette; Set firefox_binary in Capabilities to point to a supported binary"
39
+ end
40
+
33
41
@service = Service . default_service ( *extract_service_args ( opts ) )
34
42
35
43
if @service . instance_variable_get ( "@host" ) == "127.0.0.1"
@@ -41,7 +49,9 @@ def initialize(opts = {})
41
49
url = @service . uri
42
50
end
43
51
44
- caps = create_capabilities ( opts )
52
+ unless opts . empty?
53
+ raise ArgumentError , "unknown option#{ 's' if opts . size != 1 } : #{ opts . inspect } "
54
+ end
45
55
46
56
remote_opts = {
47
57
:url => url ,
@@ -71,16 +81,6 @@ def quit
71
81
72
82
private
73
83
74
- def create_capabilities ( opts )
75
- caps = opts . delete ( :desired_capabilities ) { Remote ::W3CCapabilities . firefox }
76
-
77
- unless opts . empty?
78
- raise ArgumentError , "unknown option#{ 's' if opts . size != 1 } : #{ opts . inspect } "
79
- end
80
-
81
- caps
82
- end
83
-
84
84
def extract_service_args ( opts )
85
85
args = [ ]
86
86
Original file line number Diff line number Diff line change @@ -26,6 +26,27 @@ module Firefox
26
26
compliant_on :driver => :firefox do
27
27
describe Driver do
28
28
describe ".new" do
29
+
30
+ it "should take a binary path as an argument" do
31
+ pending unless ENV [ 'MARIONETTE_PATH' ]
32
+
33
+ begin
34
+ default_path = Firefox ::Binary . path
35
+
36
+ driver1 = Selenium ::WebDriver . for :firefox
37
+ default_version = driver1 . capabilities [ :version ]
38
+ driver1 . quit
39
+
40
+ caps = Remote ::Capabilities . firefox ( firefox_binary : ENV [ 'MARIONETTE_PATH' ] )
41
+ driver2 = Selenium ::WebDriver . for :firefox , :desired_capabilities => caps
42
+
43
+ expect ( driver2 . capabilities [ :version ] ) . to_not be == default_version
44
+ driver2 . quit
45
+ ensure
46
+ Firefox ::Binary . path = default_path
47
+ end
48
+ end
49
+
29
50
it "should take a Firefox::Profile instance as argument" do
30
51
begin
31
52
profile = Selenium ::WebDriver ::Firefox ::Profile . new
You can’t perform that action at this time.
0 commit comments