Switch to headless Chrome for capybara/selenium scraping

pull/656/merge
Thibaut Courouble 8 years ago
parent 2ff56e28a1
commit 65e8236ab5

@ -49,10 +49,13 @@ module Docs
def load_capybara_selenium def load_capybara_selenium
require 'capybara/dsl' require 'capybara/dsl'
Capybara.register_driver :selenium_marionette do |app| require 'selenium/webdriver'
Capybara::Selenium::Driver.new(app, marionette: true) Capybara.register_driver :chrome do |app|
options = Selenium::WebDriver::Chrome::Options.new(args: %w[headless disable-gpu])
Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
end end
Capybara.current_driver = :selenium_marionette Capybara.javascript_driver = :chrome
Capybara.current_driver = :chrome
Capybara.run_server = false Capybara.run_server = false
Capybara Capybara
end end

Loading…
Cancel
Save