Suddenly chromedriver not working

Suddenly builds have stopped working with the following error:

Selenium::WebDriver::Error::SessionNotCreatedError:
session not created: This version of ChromeDriver only supports Chrome version 87
Current browser version is 89.0.4389.82 with binary path /usr/bin/google-chrome

I reran a build job that worked fine 4 days ago, and is now failing with the above error.

It appears that Chrome has recently updated to version 89 but ChromeDriver is still at version 87.

I have tried getting ChromeDriver to update by running bundle exec rake rake webdrivers:chromedriver:update

which reports that the upgrade to 89 has been made, but seems to have no effect.

I suspect somehow travis is keeping ChromeDriver at some non standard place?

I would be happy to backup to Chrome version 87 if anybody knows how to do that.

Here are the relevant parts of my .travis.yml file

dist: xenial

addons:
  apt:
    sources:
      - sourceline: 'deb http://dl.yarnpkg.com/debian/ stable main'
        key_url: 'http://dl.yarnpkg.com/debian/pubkey.gpg'
      - sourceline: 'deb http://dl.google.com/linux/chrome/deb/ stable main'
        key_url: 'https://dl-ssl.google.com/linux/linux_signing_key.pub'
    packages:
      - chromium-chromedriver
      - google-chrome-stable
  postgresql: '11'

_test_gem_pg: &_test_gem_pg
  before_install:
    - gem install bundler
    - echo 'install completed'

  before_script:
    - echo before_script $COMPONENT
    - cd ruby/$COMPONENT
    - bundle install --jobs=3 --retry=3
    - bundle exec rake spec:prepare
    - google-chrome --version
    - which google-chrome
    - yarn install
  script:
    - echo running script $COMPONENT
    - DRIVER=travis bundle exec rake $TASK

I added this line:

rake webdrivers:chromedriver:version

and I got this back:

2021-03-06 04:44:10 WARN Webdrivers No existing chromedriver found.

Making me think that the location webdrivers is using, is not the one travis is using…

Hopefully someone can help…

You are installing Chromedriver yourself, with a logic that you don’t show, so it’s your job to fix it.

From what you did show, it looks like you’re installing it in 2 different places, probably with different steps.

Uh thanks… I am not sure what you mean by “You are Installing Chromedriver yourself with a logic that you don’t show”

  1. I am specifying chromium-chromedriver in the addon’s packages. This is all I have ever done, and seems to have worked for at least a year.
  2. There is no other “logic” in the yml file. The only things I have removed are items like install of postgresql and stuff like that.

First, could you link to the build? Can’t tell what’s happening otherwise.

This means that there’s some unspecified Chromedriver installation logic in your Rakefile, and who knows what else. It can very well be doing something relevant on any of the rake invocations listed.

well I have this working for now by doing some workarounds. I will try to put a complete report of what I did as soon as I can (got to try to get some other things done, now that i a rolling again) However I do think there is an issue here, as all was well until Chrome updated yesterday.

Basically it seems that currently if you add the packages chromium-chromedriver and chrome-stable, you get the latest release of chrome-stable, but a quite older release of chromedriver.

If you want you can have a look at this build for example: Passed just fine a week ago, now fails because of the chromedriver mismatch. As you will see I am doing nothing special.

https://travis-ci.com/github/hyperstack-org/hyperstack/builds/218192878

You are installing Chrome from http://dl.google.com/linux/chrome/deb but Chromedriver from http://archive.ubuntu.com/ubuntu xenial-updates/universe. Of course, there’s no guarantee that they will have matching versions.

The official instructions of installing a version of Chromedriver matching your version of Chrome, from an official source, are at ChromeDriver - WebDriver for Chrome - Version Selection . I couldn’t find any official Apt repo for Chromedriver.

Looks like the webdrivers gem implements this logic – which is presumably what gets invoked with your bundle exec rake webdrivers:chromedriver:update.

So you should install Chromedriver with the webdrivers gem rather than from an Apt package.

Moreover,

1 Like

So wouldn’t it be easier if I just installed chrome from the right place (I am using Xenial)? How would I do that?

Yes using webdrivers gem works (that was the work around) but it would seem better to just have travis give me the two matching pieces in the first place. Is that possible?

Sure, you can install the browser from the official Ubuntu repos just like Chromedriver. But, Ubuntu official repos have Chromium, not Chrome, and you may not be getting the latest version.

No, Travis’ chrome addon installs Chrome but not Chromedriver. There has been a complaint about that already.

Since webdrivers uses the official logic, I wouldn’t call using it “a workaround”.

1 Like

Thanks for your help. I think its pretty obvious I have no clue what I am doing here. Another contributor set up travis, but has since left the project, so I am limping along here.

I guess you are saying just keep using webdrivers, but I wonder still if I am doing something wrong, as normally webdrivers just runs automatically. To get it to work I had to run it, then copy the chromedriver it installed to some other location. I tried changing webdrivers default install location, but that didn’t work because it doesn’t have permission. I tried sudo but that didn’t work because I guess its not set up to allow binaries to run from other locations.

So I did the copy thing, but it just feels very “cludgy” and makes me think I am doing something wrong.

Surely there other people using ruby and chrome and chrome driver? Isn’t there a standard way to do this?

According to GitHub - titusfortner/webdrivers: Keep your Selenium WebDrivers updated automatically, it will install an appropriate driver when you instantiate a corresponding Selenium WebDriver instance if you require 'webdrivers' first. But AFAICS, you never do that.
Moreover, some of your gemspecs require chromedriver-helper which has been discontinued in favor of webdrivers. So I guess it worked when that old gem was still working.