'byebug' Dotenv.load Capybara.configure do |capybara_config| capybara_config.default_driver = :selenium_chrome capybara_config.default_max_wait_time = 10 # seconds end Capybara.register_driver :selenium_chrome do |app| options = Selenium::WebDriver::Chrome::Options.new options.add_argument('headless') if ENV['HEADLESS'] == 'true' Capybara::Selenium::Driver.new(app, browser: :chrome, options: options) end Capybara.javascript_driver = :selenium_chrome