Skip to content

Instantly share code, notes, and snippets.

@jdelStrother
Created June 17, 2017 08:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdelStrother/2ce5786f774962c287f44704b3cd978f to your computer and use it in GitHub Desktop.
Save jdelStrother/2ce5786f774962c287f44704b3cd978f to your computer and use it in GitHub Desktop.
Capybara.register_driver :chrome do |app|
require 'selenium-webdriver'
client = Selenium::WebDriver::Remote::Http::Default.new
opts = {
chrome_options: {
# Canary has a couple of benefits right now - eg screenshots actually work.
binary: "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary"
args: %w[headless]
}
}
if ENV['CAPYBARA_DEBUG']
opts[:loggingPrefs] = { browser: 'ALL', driver: 'ALL' }
end
caps = Selenium::WebDriver::Remote::Capabilities.chrome(opts)
Capybara::Selenium::Driver.new(app, browser: :chrome,
http_client: client,
driver_opts: { log_path: Rails.root.join("log/test-chrome-#{ENV['TEST_ENV_NUMBER']}.log") },
desired_capabilities: caps)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment