Skip to content

Commit

Permalink
rb - update to latest geckodriver
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Jun 9, 2016
1 parent 9f51796 commit 3c0e38c
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 33 deletions.
3 changes: 2 additions & 1 deletion rb/lib/selenium/webdriver/common/platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ def find_binary(*binary_names)

binary_names.each do |binary_name|
paths.each do |path|
exe = File.join(path, binary_name)
exe = Dir.glob(File.join(path, binary_name)).first
next unless exe
return exe if File.executable?(exe)
end
end
Expand Down
4 changes: 2 additions & 2 deletions rb/lib/selenium/webdriver/firefox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module Firefox
DEFAULT_ASSUME_UNTRUSTED_ISSUER = true
DEFAULT_LOAD_NO_FOCUS_LIB = false

MISSING_TEXT = "Unable to find Mozilla Wires. Please download the executable from https://github.com/jgraham/wires/releases"
MISSING_TEXT = "Unable to find Mozilla geckodriver. Please download the executable from https://github.com/mozilla/geckodriver/releases"

def self.driver_path=(path)
Platform.assert_executable path
Expand All @@ -50,7 +50,7 @@ def self.driver_path=(path)

def self.driver_path
@driver_path ||= begin
path = Platform.find_binary("wires")
path = Platform.find_binary("geckodriver*") || Platform.find_binary("wires*")
path or raise Error::WebDriverError, MISSING_TEXT
Platform.assert_executable path

Expand Down
4 changes: 2 additions & 2 deletions rb/lib/selenium/webdriver/firefox/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def start_process
@process.io.inherit!
elsif Platform.windows?
# workaround stdio inheritance issue
# https://github.com/jgraham/wires/issues/48
# https://github.com/mozilla/geckodriver/issues/48
@process.io.stdout = @process.io.stderr = File.new(Platform.null_device, 'w')
end

Expand All @@ -57,7 +57,7 @@ def stop_server
end

def cannot_connect_error_text
"unable to connect to Mozilla Wires #{@host}:#{@port}"
"unable to connect to Mozilla geckodriver #{@host}:#{@port}"
end

end # Service
Expand Down
6 changes: 0 additions & 6 deletions rb/lib/selenium/webdriver/remote/w3c_capabilities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ class W3CCapabilities
:platform_name => :any,
:platform_version => :any,
:accept_ssl_certs => false,
:takes_screenshot => false,
:takes_element_screenshot => false,
:page_load_strategy => 'normal',
:proxy => nil
}
Expand Down Expand Up @@ -112,8 +110,6 @@ def json_create(data)
caps.platform_name = data.delete("platformName") if data.key? "platformName"
caps.platform_version = data.delete("platformVersion") if data.key? "platformVersion"
caps.accept_ssl_certs = data.delete("acceptSslCerts") if data.key? "acceptSslCerts"
caps.takes_screenshot = data.delete("takesScreenshot") if data.key? "takesScreenshot"
caps.takes_element_screenshot = data.delete("takesElementScreenshot") if data.key? "takesElementScreenshot"
caps.page_load_strategy = data.delete("pageLoadStrategy") if data.key? "pageloadStrategy"
proxy = data.delete('proxy')
caps.proxy = Proxy.json_create(proxy) unless proxy.nil? || proxy.empty?
Expand Down Expand Up @@ -144,8 +140,6 @@ def json_create(data)
# @option :platform_name [Symbol] one of :any, :win, :mac, or :x
# @option :platform_version [String] required platform version number
# @option :accept_ssl_certs [Boolean] does the driver accept SSL Cerfifications?
# @option :takes_screenshot [Boolean] can this driver take screenshots?
# @option :takes_element_screenshot [Boolean] can this driver take element screenshots?
# @option :proxy [Selenium::WebDriver::Proxy, Hash] proxy configuration
#
# @api public
Expand Down
37 changes: 16 additions & 21 deletions rb/spec/integration/selenium/webdriver/firefox/marionette_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ def restart_remote_server
expect(driver1.capabilities.platform_name).to_not be_nil
expect(driver1.capabilities.platform_version).to_not be_nil
expect(driver1.capabilities.accept_ssl_certs).to be == false
expect(driver1.capabilities.takes_screenshot).to be == true
expect(driver1.capabilities.takes_element_screenshot).to be == true
expect(driver1.capabilities.page_load_strategy).to be == 'normal'
expect(driver1.capabilities.proxy).to be_nil
if GlobalTestEnv.driver == :remote
Expand Down Expand Up @@ -90,46 +88,43 @@ def restart_remote_server
end
end

context "when designated firefox binary includes Marionette" do
compliant_on :browser => :marionette do
# This passes in isolation, but can not run in suite due to combination of
# https://bugzilla.mozilla.org/show_bug.cgi?id=1228107 & https://github.com/SeleniumHQ/selenium/issues/1150
not_compliant_on :driver => :resmote do
it "Uses Wires when setting marionette option in capabilities" do
caps = Selenium::WebDriver::Remote::Capabilities.firefox(:marionette => true)
@opt[:desired_capabilities] = caps
expect { @driver1 = Selenium::WebDriver.for GlobalTestEnv.driver, @opt }.to_not raise_exception
@driver1.quit
end
end
compliant_on :browser => :marionette do
it "Uses geckodriver when setting marionette option in capabilities" do
caps = Selenium::WebDriver::Remote::Capabilities.firefox(:marionette => true)
@opt[:desired_capabilities] = caps
expect { @driver1 = Selenium::WebDriver.for GlobalTestEnv.driver, @opt }.to_not raise_exception
@driver1.quit
end

compliant_on :browser => :marionette do
# This passes in isolation, but can not run in suite due to combination of
# https://bugzilla.mozilla.org/show_bug.cgi?id=1228107 & https://github.com/SeleniumHQ/selenium/issues/1150
it "Uses Wires when setting marionette option in driver initialization" do
it "Uses geckodriver when setting marionette option in driver initialization" do
@opt[:marionette] = true
driver1 = Selenium::WebDriver.for GlobalTestEnv.driver, @opt

expect(driver1.capabilities[:takes_element_screenshot]).to_not be_nil
expect(driver1.capabilities[:browser_version]).to_not be_nil
driver1.quit
end
end

# test with firefox due to https://bugzilla.mozilla.org/show_bug.cgi?id=1228121
compliant_on :browser => :firefox do
it "Does not use wires when marionette option is not set" do
it "Does not use geckodriver when marionette option is not set" do
driver1 = Selenium::WebDriver.for GlobalTestEnv.driver, @opt

expect { driver1.capabilities.browser_version }.to raise_exception NoMethodError
expect { driver1.capabilities.browser_version }.to raise_exception NoMethodError
driver1.quit
end
end

compliant_on :driver => :marionette do
context 'when shared example' do
before { driver }
it_behaves_like "driver that can be started concurrently", :marionette
# https://github.com/mozilla/geckodriver/issues/58
not_compliant_on :driver => :marionette do
context 'when shared example' do
before { driver }
it_behaves_like "driver that can be started concurrently", :marionette
end
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

let(:new_window) { driver.window_handles.find { |handle| handle != driver.window_handle } }

# https://github.com/jgraham/wires/issues/52
# https://github.com/mozilla/geckodriver/issues/52
not_compliant_on :browser => :marionette do
# https://github.com/SeleniumHQ/selenium/issues/1795
not_compliant_on :driver => :remote, :browser => [:edge, :marionette] do
Expand Down

0 comments on commit 3c0e38c

Please sign in to comment.