The warning I'm receiving is: WARN Selenium [DEPRECATION] [:capabilities_hash] passing a Hash value to :capabilities is deprecated. Use Capabilities instance initialized with the Hash, or build values with Options class instead.
My driver setup looks like:
Capybara.register_driver :aws_chrome do |app|
client = Selenium::WebDriver::Remote::Http::Default.new
client.read_timeout = 180
capabilities = {
'browserName': 'chrome',
'aws:maxDurationSecs': 2400
}
Capybara::Selenium::Driver.new(app, browser: :remote, http_client: client, url: remote_url, capabilities: capabilities)
end
I'm not sure what a capabilities instance is supposed to be, and there's no documentation on how to use the Options class that I could find. I also need to be able to set the browserName
to firefox
as needed, so I'm not sure if the Options class is specific to chrome.
Thanks in advance.
I'm not familiar with ruby, but for using options instead of capabilities try:
Capybara.register_driver :aws_chrome do |app|
client = Selenium::WebDriver::Remote::Http::Default.new
client.read_timeout = 180
options = Selenium::WebDriver::Chrome::Options.new
options.add_option('aws:maxDurationSecs', 2400)
Capybara::Selenium::Driver.new(app, browser: :remote, http_client: client, url: remote_url, options: options)
end
This is Options class api doc for selenium 4:
https://www.selenium.dev/selenium/docs/api/rb/Selenium/WebDriver/Options.html