Skip to content

Instantly share code, notes, and snippets.

@fernyb
Last active October 18, 2018 18:26
Show Gist options
  • Save fernyb/cdcf1f5e27a8d89a994c17213cffe9be to your computer and use it in GitHub Desktop.
Save fernyb/cdcf1f5e27a8d89a994c17213cffe9be to your computer and use it in GitHub Desktop.
ruby selenium webdriver chrome capabilities options headless
caps = Selenium::WebDriver::Remote::Capabilities.chrome
caps['acceptInsecureCerts'] = true
caps['acceptSslCerts'] = true
caps['loggingPrefs'] = { 'performance' => 'ALL' }
caps['chromeOptions'] = {
'perfLoggingPrefs' => { 'enableNetwork' => true },
:args => [
"--disable-web-security",
"--allow-running-insecure-content",
"--ignore-certificate-errors",
"--allow-insecure-localhost",
"--no-sandbox",
"--disable-popup-blocking",
"--disable-translate",
"--window-size=1400,1920",
"--disable-extensions-file-access-check",
"--disable-extensions",
"--disable-impl-side-painting"
"--headless",
"--disable-gpu"
]
}
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app,
:url => "http://localhost:4444/wd/hub",
:browser => :remote,
:desired_capabilities => caps
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment