I\'m learning to use Selenium for basic things like taking a screenshot, scraping, and testing and would like to use it with headless Chrome, which is now stable as of Chrome 59
I've written a blog post about how to do it. Summing up:
1) Make sure you have Chrome version 57+ on Linux, 59+ on macOS or 60+ on Windows;
2) Add/update the gem selenium-webdriver
;
3) Make sure you’re using ChromeDriver version 2.30 or higher;
4) Add the following driver to your spec_helper.rb
or rails_helper.rb
:
Capybara.register_driver :chrome do |app|
Capybara::Selenium::Driver.new app, browser: :chrome,
options: Selenium::WebDriver::Chrome::Options.new(args: %w[headless disable-gpu])
end
Capybara.javascript_driver = :chrome