Rails/Capybara: ChromeDriver complains about missing Chrome binary, even though it is present

78 Views Asked by At

Recently, my Capybara feature specs started failing, complaining about a missing Chrome binary. However, the Chrome binary is clearly present in that location: for example, entering /usr/bin/google-chrome in a terminal starts Chrome.

Selenium::WebDriver::Error::UnknownError:
       unknown error: no chrome binary at /usr/bin/google-chrome
     # #0 0x561b988f1e43 <unknown>
     # #1 0x561b985ba687 <unknown>
     ...

I have tried explicitly setting the path of the binary, but it doesn't help: it already has the correct path anyway.

Here's the Capybara config file, which has been working fine for years.

require "capybara/rails"
require "capybara/rspec"
require "selenium/webdriver"

Capybara.register_driver :headless_chrome do |app|
  options = Selenium::WebDriver::Chrome::Options.new
  options.add_argument("--headless=true")
  options.add_argument("--ignore-certificate-errors")
  options.add_argument("--window-size=1280,1920")
  options.add_argument("--proxy-server=#{Billy.proxy.host}:#{Billy.proxy.port}")

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

Capybara.javascript_driver = :headless_chrome

Recently I ran a bundle update, which may be the origin of the problem. Or possibly a Chrome/Chromedriver update.

0

There are 0 best solutions below