Using Rails 6 I'm trying to set up selenium in headless mode for system tests, I'm using this statement in application_system_test_case.db:
driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400]
(according to Agile Web Dev Rails 6 tutorial)
but it gives me this deprecation warning:
Selenium [DEPRECATION] [:browser_options] :options as a parameter for driver initialization is deprecated. Use :capabilities with an Array of value capabilities/options if necessary instead.
I've done some searching in Selenium docs but I my basic code skills still leave me unclear as to how I should correct this. Can anyone advise how I can correct this?
(My amateur guesswork trials of things like:
driven_by :selenium, :capabilities['headless_chrome', 'screen_size: 1400, 1400']
all result in errors)
summarized:
Capybara.register_driver :https_chrome do |app|
options = Selenium::WebDriver::Chrome::Options.new
options.add_argument('--allow-insecure-localhost')
options.add_argument('--ignore-certificate-errors')
Capybara::Selenium::Driver.new(
app,
browser: :chrome,
capabilities: [options]
)
end
Capybara.register_driver :headless_https_chrome do |app|
options = Selenium::WebDriver::Chrome::Options.new
options.add_argument('--headless')
options.add_argument('--allow-insecure-localhost')
options.add_argument('--ignore-certificate-errors')
Capybara::Selenium::Driver.new(
app,
browser: :chrome,
capabilities: [options]
)
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With