Created
June 27, 2017 11:16
-
-
Save luke-hill/9d14fc1e10dad1236d36a63de62929a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_remote_driver(browser, platform) | |
if browser == :firefox | |
capabilities = Selenium::WebDriver::Remote::Capabilities.firefox( | |
platform: platform, | |
marionette: false, | |
) | |
elsif browser == :chrome | |
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome( | |
'chromeOptions' => chrome_switches, | |
platform: platform, | |
takes_screenshot: true, | |
) | |
else | |
capabilities = Selenium::WebDriver::Remote::Capabilities.internet_explorer( | |
platform: platform, | |
javascript_enabled: true, | |
enable_persistent_hover: true, # Constantly fire mouseOver events | |
) | |
capabilities['ie.ensureCleanSession'] = true # Wipe all history and cookies | |
end | |
Capybara.register_driver :selenium do |app| | |
client = Selenium::WebDriver::Remote::Http::Default.new | |
client.timeout = 120 | |
Capybara::Selenium::Driver.new( | |
app, | |
browser: :remote, | |
url: ENV['hub_url'], | |
desired_capabilities: capabilities, | |
http_client: client, | |
) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment