Sha256: a1df27cc6e7bec5ce221227ff9c9b76cd2189a9544fb30cc4ad09f17c04ea8d8

Contents?: true

Size: 696 Bytes

Versions: 1

Compression:

Stored size: 696 Bytes

Contents

# :headless_chrome driver

Capybara.register_driver :headless_chrome do |app|
  startup_flags = ['headless']
  startup_flags << 'start-fullscreen' if Howitzer.maximized_window
  startup_flags << "user-agent=#{Howitzer.user_agent}" if Howitzer.user_agent.present?
  startup_flags.concat(Howitzer.headless_chrome_flags.split(/\s*,\s*/)) if Howitzer.headless_chrome_flags
  options = Selenium::WebDriver::Chrome::Options.new(args: startup_flags)
  params = { browser: :chrome, options: options }
  Capybara::Selenium::Driver.new app, params
end

Capybara.save_path = Howitzer.log_dir
Capybara::Screenshot.register_driver(:headless_chrome) do |driver, path|
  driver.browser.save_screenshot path
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
howitzer-2.1.0 generators/config/templates/drivers/headless_chrome.rb