Bump selenium-webdriver from 4.0.0 to 4.11.0

Webdrivers doesn't seem to be working with GitHub Actions since Chrome
changed the way to download ChromeDriver [1].

Luckily, webdrivers functionality has recently been added directly to
selenium-webdriver, and version 4.11.0 is compatible with the new way to
download ChromeDriver.

So we're updating selenium-webdriver and removing webdrivers.

Note we now have to use the `Options` class instead of the
`Capabilities`. We're updating Capybara since its changelog mentions its
latest version also adapts these changes in Selenium.

[1] https://groups.google.com/g/chromedriver-users/c/qVPTFXnedw0
This commit is contained in:
Javi Martín
2023-07-25 23:02:42 +02:00
parent 28a9bd55c6
commit 5b0fb3213d
3 changed files with 16 additions and 25 deletions

View File

@@ -54,17 +54,14 @@ end
FactoryBot.use_parent_strategy = false
Capybara.register_driver :headless_chrome do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
"goog:chromeOptions" => {
args: %W[headless no-sandbox window-size=1200,800 proxy-server=#{Capybara.app_host}:#{Capybara::Webmock.port_number}]
}
)
options = Selenium::WebDriver::Chrome::Options.new.tap do |opts|
opts.add_argument "--headless"
opts.add_argument "--no-sandbox"
opts.add_argument "--window-size=1200,800"
opts.add_argument "--proxy-server=#{Capybara.app_host}:#{Capybara::Webmock.port_number}"
end
Capybara::Selenium::Driver.new(
app,
browser: :chrome,
capabilities: capabilities
)
Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
end
Capybara.exact = true