Skip to content

Commit

Permalink
rb - update w3c support
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Mar 12, 2016
1 parent 981cb1a commit 1e255d2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 14 deletions.
4 changes: 4 additions & 0 deletions rb/lib/selenium/webdriver/firefox/binary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ def path=(path)
@path = path
end

def reset_path!
@path = nil
end

def path
@path ||= case Platform.os
when :macosx
Expand Down
37 changes: 24 additions & 13 deletions rb/lib/selenium/webdriver/remote/w3c_capabilities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,17 @@ class W3CCapabilities
:proxy => nil
}

DEFAULTS.each_key do |key|
KNOWN = [
:remote_session_id,
:specification_level,
:xul_app_id,
:raise_accessibility_exceptions,
:rotatable,
:app_build_id,
:device
]

(DEFAULTS.keys + KNOWN).each do |key|
define_method key do
@capabilities.fetch(key)
end
Expand Down Expand Up @@ -94,19 +104,20 @@ def json_create(data)
data = data.dup

# Convert due to Remote Driver implementation
data["browserVersion"] = data.delete("version") if data["version"]
data["platformName"] = data.delete("platform") if data["platform"]
data["browserVersion"] = data.delete("version") if data.key? "version"
data["platformName"] = data.delete("platform") if data.key? "platform"

caps = new
caps.browser_name = data.delete("browserName") if data["browserName"]
caps.browser_version = data.delete("browserVersion") if data["browserVersion"]
caps.platform_name = data.delete("platformName") if data["platformName"]
caps.platform_version = data.delete("platformVersion") if data["platformVersion"]
caps.accept_ssl_certs = data.delete("acceptSslCerts") if data["acceptSslCerts"]
caps.takes_screenshot = data.delete("takesScreenshot") if data["takesScreenshot"]
caps.takes_element_screenshot = data.delete("takesElementScreenshot") if data["takesElementScreenshot"]
caps.page_load_strategy = data.delete("pageLoadStrategy") if data["pageloadStrategy"]
caps.proxy = Proxy.json_create(data['proxy']) if data['proxy']
caps.browser_name = data.delete("browserName") if data.key? "browserName"
caps.browser_version = data.delete("browserVersion") if data.key? "browserVersion"
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.empty?

# Remote Server Specific
caps[:remote_session_id] = data.delete('webdriver.remote.sessionid')
Expand All @@ -116,7 +127,7 @@ def json_create(data)
data.delete('cssSelectorsEnabled')

# Marionette Specific
caps[:specification_level] = data.delete("specificaionLevel")
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 Down
2 changes: 1 addition & 1 deletion rb/lib/selenium/webdriver/remote/w3c_commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class Selenium::WebDriver::Remote::W3CBridge
command :findElements, :post, "session/:session_id/elements"
command :findChildElement, :post, "session/:session_id/element/:id/element"
command :findChildElements, :post, "session/:session_id/element/:id/elements"
command :getActiveElement, :post, "session/:session_id/element/active"
command :getActiveElement, :get, "session/:session_id/element/active"
command :isElementSelected, :get, "session/:session_id/element/:id/selected"
command :getElementAttribute, :get, "session/:session_id/element/:id/attribute/:name"
command :getElementProperty, :get, "session/:session_id/element/:id/property/:name"
Expand Down

0 comments on commit 1e255d2

Please sign in to comment.