If you have some tests that use ChromeDriver to run in a browser environment, and you’re seeing errors like This version of ChromeDriver only supports Chrome version 114, and you’d rather do some useful work than waste time fixing stuff that worked last week, here’s a quick fix that worked for me on Linux. Something similar might work on Mac OS. I’ve no idea about Windows.

This all started when I had to make a video call on Slack. I avoid using the advertising behemoth’s browser as far as possible, but Slack video calls don’t work in Firefox (due to an aggressive failure to be arsed on the part of Slack/Salesforce), so I use Chrome for the one time a week I need to do that. Last week, Slack refused to work on the “too old” version of Chrome that I had installed, so I had to update. Updating Chrome broke ChromeDriver, and I couldn’t fix that without updating the selenium-webdriver gem, and I couldn’t update that without updating Ruby, and I couldn’t do that without updating the Stripe gem, which isn’t trivial, and, well, I am in the process of doing all these things, but I’m not there yet. In the meantime, this was all extremely unhelpful.

In an ideal world, I wouldn’t face problems with incompatibilities between libraries, versions of Chrome, versions of Ruby, and Google changing how they publish the location of the chromedriver executable. To be honest, in an ideal world, I don’t think any of this stuff would exist. In this vale of tears, however, it’s always more complicated.

The basic idea behind this solution is to download a matching pair of mutually compatible Chrome for Testing and ChromeDriver and to use these when running tests. This also means that if you have another version of Chrome installed, upgrades to that shouldn’t break the ChromeDriver integration in future.

  1. Visit the Chrome for Testing page and download the stable chrome-linux64.zip and chromedriver-linux64.zip packages. You’ll have to copy and paste the URLs. I don’t know why they don’t make them links.

  2. Extract chrome-linux64.zip somewhere useful:

    $ mkdir -p ~/.local/opt
    $ unzip -d ~/.local/opt chrome-linux64.zip
    
  3. Extract chromedriver-linux64.zip and copy the chromedriver binary into the same location as chrome:

    $ unzip -j -d ~/.local/opt/chrome-linux64 chromedriver-linux64.zip
    
  4. Add the chrome directory to your path:

    $ export PATH="$HOME/.local/opt/chrome-linux64:$PATH"
    

    You can test this:

    $ which chrome
    /home/paul/.local/opt/chrome-linux64/chrome
    $ which chromedriver
    /home/paul/.local/opt/chrome-linux64/chromedriver
    

    You might wish to add this to your path for all sessions, or just to add it when running tests. If you’re running tests from your editor, configure it appropriately. That’s up to you. I’ve added the export line to a file that I load into zsh using source chromedriver.sh when I need it.

This should work for a while, until the next time that someone changes something significant for no apparent good reason.