Skip to content

Instantly share code, notes, and snippets.

@matthewrudy
Created June 26, 2017 09:58
Show Gist options
  • Save matthewrudy/d6c4c3709ff3d61ee24d7eb7aa117c9f to your computer and use it in GitHub Desktop.
Save matthewrudy/d6c4c3709ff3d61ee24d7eb7aa117c9f to your computer and use it in GitHub Desktop.
Running headless chrome on capybara with selenium webdriver
require "selenium/webdriver"
Capybara.register_driver :chrome do |app|
Capybara::Selenium::Driver.new(app, browser: :chrome)
end
Capybara.register_driver :headless_chrome do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
chromeOptions: { args: %w(headless disable-gpu) }
)
Capybara::Selenium::Driver.new app,
browser: :chrome,
desired_capabilities: capabilities
end
Capybara.default_driver = ENV['CODESHIP'] ? :chrome : :headless_chrome
@rtsinani
Copy link

Thanks @sytzez 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment