I'm trying to configure RSpec suite to run against Chromium browser (instead of google-chrome)...
The test suite fails with the following error
     1.2) Failure/Error: Unable to infer file and line number from backtrace
          Selenium::WebDriver::Error::SessionNotCreatedError:
            session not created: This version of ChromeDriver only supports Chrome version 80
          # 0   chromedriver                        0x0000000103190329 chromedriver + 3838761
          # 1   chromedriver                        0x000000010312a123 chromedriver + 3420451
          # yada yada
I've installed ChromeDriver and chromium browser (via brew cask install chromedriver chromium)...
here is the spec_helper.rb configurations for capybara
require "capybara/rails"
require "capybara/rspec"
require "capybara-screenshot/rspec"
require "selenium/webdriver"
# Capybara.default_driver = :selenium_chrome_headless
Capybara.default_driver = :selenium_chrome
This works perfectly when chrome is installed (same v.82 as chromium) but doesn't work with chromium... is there any way to get the selenium chrome driver to work with chromium?
Here's one way to do it:
require 'capybara'
require 'capybara/dsl'
require 'selenium-webdriver'
include Capybara::DSL
Capybara.register_driver :selenium_chromium do |app|
  options = Selenium::WebDriver::Chrome::Options.new(binary: "/Applications/Chromium.app/Contents/MacOS/Chromium")
  Capybara::Selenium::Driver.new(app, :browser => :chrome, options: options)
end
Capybara.current_driver = :selenium_chromium
Capybara.app_host = 'https://example.org'
visit('/')
As you discovered, the Chrome/Chromium version needs to match the ChromeDriver version. This means that brew cask install chromium will probably not work because it will install the latest nightly build.
To get a working Chromium build, first check your ChromeDriver version:
$ chromedriver --version
ChromeDriver 81.0.4044.69 (6813546031a4bc83f717a2ef7cd4ac6ec1199132-refs/branch-heads/4044@{#776})
Next, you need to find a stable Chromium build with the same major version. I'd suggest grabbing a build from https://chromium.woolyss.com/ -- it will have a tag like:
81.0.4044.129 (737173) • Tuesday, 28 Apr 2020
If you know the build number (737173 in this example), you can also download a compatible snapshot from the Chromium build repository:
https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/737173/chrome-mac.zip
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