Sha256: 7e5bd8937e92485314ac9c91047cf59234e0e5772757d5a4e83181ed401545e9

Contents?: true

Size: 1.19 KB

Versions: 5

Compression:

Stored size: 1.19 KB

Contents

require 'selenium-webdriver'
require 'show_me_the_cookies'

Capybara.register_driver :chrome_headless do |app|
  Capybara::Selenium::Driver.load_selenium
  browser_options = ::Selenium::WebDriver::Chrome::Options.new.tap do |opts|
    opts.args << '--headless=new'
    opts.args << '--disable-gpu' if Gem.win_platform?
    opts.args << '--no-sandbox'
    # Workaround https://bugs.chromium.org/p/chromedriver/issues/detail?id=2650&q=load&sort=-id&colspec=ID%20Status%20Pri%20Owner%20Summary
    opts.args << '--disable-site-isolation-trials'
    opts.args << '--window-size=1920,1080'
    opts.args << '--enable-features=NetworkService,NetworkServiceInProcess'
  end
  # Hide messages such as the following:
  # WARN Selenium [:logger_info] Details on how to use and modify Selenium logger:
  #   https://selenium.dev/documentation/webdriver/troubleshooting/logging#ruby
  Selenium::WebDriver.logger.ignore([:logger_info])

  Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options)
end

Capybara::Screenshot.register_driver(:chrome_headless) do |driver, path|
  driver.browser.save_screenshot(path)
end

ShowMeTheCookies.register_adapter(:chrome_headless, ShowMeTheCookies::SeleniumChrome)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ndr_dev_support-7.3.1 lib/ndr_dev_support/integration_testing/drivers/chrome_headless.rb
ndr_dev_support-7.3.0 lib/ndr_dev_support/integration_testing/drivers/chrome_headless.rb
ndr_dev_support-7.2.6 lib/ndr_dev_support/integration_testing/drivers/chrome_headless.rb
ndr_dev_support-7.2.5 lib/ndr_dev_support/integration_testing/drivers/chrome_headless.rb
ndr_dev_support-7.2.4 lib/ndr_dev_support/integration_testing/drivers/chrome_headless.rb