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 89495c9 commit 63e0aa8
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 36 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 @@ -168,7 +168,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
6 changes: 3 additions & 3 deletions rb/lib/selenium/webdriver/firefox/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ class Service
SOCKET_LOCK_TIMEOUT = 45
STOP_TIMEOUT = 5
DEFAULT_PORT = 4444
MISSING_TEXT = "Unable to find Mozilla Wires. Please download the executable from https://github.com/jgraham/wires/releases"
MISSING_TEXT = "Unable to find geckodriver. Please download the executable from https://github.com/mozilla/geckodriver/releases"

def self.executable_path
@executable_path ||= (
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 Expand Up @@ -109,7 +109,7 @@ def connect_until_stable
@socket_poller = SocketPoller.new @host, @port, START_TIMEOUT

unless @socket_poller.connected?
raise Error::WebDriverError, "unable to connect to Mozilla Wires #{@host}:#{@port}"
raise Error::WebDriverError, "unable to connect to Mozilla geckodriver #{@host}:#{@port}"
end
end

Expand Down
8 changes: 0 additions & 8 deletions rb/lib/selenium/webdriver/remote/w3c_capabilities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,12 @@ 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
}

KNOWN = [
:remote_session_id,
:specification_level,
:xul_app_id,
:raise_accessibility_exceptions,
:rotatable,
Expand Down Expand Up @@ -113,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 All @@ -127,7 +122,6 @@ def json_create(data)
data.delete('cssSelectorsEnabled')

# Marionette Specific
caps[:specification_level] = data.delete("specificationLevel")
caps[:xul_app_id] = data.delete("XULappId")
caps[:raise_accessibility_exceptions] = data.delete('raisesAccessibilityExceptions')
caps[:rotatable] = data.delete('rotatable')
Expand All @@ -146,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
42 changes: 19 additions & 23 deletions rb/spec/integration/selenium/webdriver/firefox/marionette_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,13 @@ def restart_remote_server(path = nil)
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
expect(driver1.capabilities.remote_session_id).to match /^\h{8}-\h{4}-\h{4}-\h{4}-\h{10}/
else
expect(driver1.capabilities.remote_session_id).to be_nil
end
expect(driver1.capabilities.specification_level).to be == '1'
expect(driver1.capabilities.raise_accessibility_exceptions).to be == false
expect(driver1.capabilities.rotatable).to be == false
ensure
Expand All @@ -75,7 +72,7 @@ def restart_remote_server(path = nil)
driver1 = Selenium::WebDriver.for GlobalTestEnv.driver, @opt

default_version = driver1.capabilities.version
expect { driver1.capabilities.specification_level }.to_not raise_exception NoMethodError
expect { driver1.capabilities.browser_version }.to_not raise_exception NoMethodError
driver1.quit

if GlobalTestEnv.driver == :remote
Expand All @@ -87,7 +84,7 @@ def restart_remote_server(path = nil)
driver2 = Selenium::WebDriver.for GlobalTestEnv.driver, @opt

expect(driver2.capabilities.version).to_not be == default_version
expect { driver2.capabilities.specification_level }.to_not raise_exception NoMethodError
expect { driver2.capabilities.browser_version }.to_not raise_exception NoMethodError
driver2.quit
ensure
Firefox::Binary.reset_path!
Expand All @@ -97,44 +94,43 @@ def restart_remote_server(path = nil)

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
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
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.specification_level }.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 All @@ -150,7 +146,7 @@ def restart_remote_server(path = nil)
end
end

it "Raises Wires Exception when setting marionette option in capabilities" do
it "Raises geckodriver Exception when setting marionette option in capabilities" do
begin
caps = Selenium::WebDriver::Remote::Capabilities.firefox(:marionette => true,
:firefox_binary => ENV['PRE_MARIONETTE_BINARY'])
Expand All @@ -161,7 +157,7 @@ def restart_remote_server(path = nil)
end
end

it "Raises Wires Exception when setting marionette option in driver initialization" do
it "Raises geckodriver Exception when setting marionette option in driver initialization" do
begin
caps = Selenium::WebDriver::Remote::Capabilities.firefox(:firefox_binary => ENV['PRE_MARIONETTE_BINARY'])
@opt.merge!(:marionette => true, :desired_capabilities => caps)
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 63e0aa8

Please sign in to comment.