Virtual-environments: Add chrome webdriver to Ubuntu

Created on 3 Oct 2019  路  20Comments  路  Source: actions/virtual-environments

Tool information

  • Tool name: Chrome webdriver
  • Add or update? add
  • Desired version: whatever is latest
  • Approximate size:
  • If this is an add request:

    • Brief description of tool: ChromeDriver is a separate executable that Selenium WebDriver uses to control Chrome. It is commonly used as part of browser automation/system tests

    • URL for tool's homepage: https://chromedriver.chromium.org/

Virtual environments affected

  • [ ] macOS 10.14
  • [x] Ubuntu 16.04 LTS
  • [x] Ubuntu 18.04 LTS
  • [ ] Windows Server 2016 R2
  • [ ] Windows Server 2019

Can this tool be installed during the build?
Currently working around this limitation with a build step that does:

sudo apt-get -yqq install chromium-chromedriver

Currently this steps takes ~2 minutes and must be run on every build that will run browser tests. :(

Ubuntu awaiting-deployment

Most helpful comment

My script to install right version of chromedriver, tested on ubuntu 18.04

  - name: Install ChromeDriver
    run: |
      CHROME_VERSION=$(google-chrome --version | cut -f 3 -d ' ' | cut -d '.' -f 1) \
        && CHROMEDRIVER_RELEASE=$(curl --location --fail --retry 3 http://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_VERSION}) \
        && curl --silent --show-error --location --fail --retry 3 --output /tmp/chromedriver_linux64.zip "http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_RELEASE/chromedriver_linux64.zip" \
        && cd /tmp \
        && unzip chromedriver_linux64.zip \
        && rm -rf chromedriver_linux64.zip \
        && sudo mv chromedriver /usr/local/bin/chromedriver \
        && sudo chmod +x /usr/local/bin/chromedriver \
        && chromedriver --version

It also takes less time than apt-get install chromium-chromedriver.

All 20 comments

As of yesterday, apt-get was failing to install however:

E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/universe/c/chromium-browser/chromium-codecs-ffmpeg-extra_76.0.3809.100-0ubuntu0.18.04.1_amd64.deb  404  Not Found [IP: 52.168.50.79 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/universe/c/chromium-browser/chromium-browser_76.0.3809.100-0ubuntu0.18.04.1_amd64.deb  404  Not Found [IP: 52.168.50.79 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/universe/c/chromium-browser/chromium-browser-l10n_76.0.3809.100-0ubuntu0.18.04.1_all.deb  404  Not Found [IP: 52.168.50.79 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/universe/c/chromium-browser/chromium-chromedriver_76.0.3809.100-0ubuntu0.18.04.1_amd64.deb  404  Not Found [IP: 52.168.50.79 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
##[error]Process completed with exit code 100.

Did you apt update before that?

Ideally we'd have geckodriver preinstalled too.

I'm not sure what it takes to get software added to GitHub's runners but this is essential. Please add them. :persevere:

The Windows environments seem to have all Selenium WebDrivers installed which is a huge convenience. The Ubuntu environments already have Firefox and Chrome Browsers installed at specific versions so having to pick out the right WebDriver versions just for running in GitHub's runners and caching them to avoid downloading on every run is tedious.

My script to install right version of chromedriver, tested on ubuntu 18.04

  - name: Install ChromeDriver
    run: |
      CHROME_VERSION=$(google-chrome --version | cut -f 3 -d ' ' | cut -d '.' -f 1) \
        && CHROMEDRIVER_RELEASE=$(curl --location --fail --retry 3 http://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_VERSION}) \
        && curl --silent --show-error --location --fail --retry 3 --output /tmp/chromedriver_linux64.zip "http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_RELEASE/chromedriver_linux64.zip" \
        && cd /tmp \
        && unzip chromedriver_linux64.zip \
        && rm -rf chromedriver_linux64.zip \
        && sudo mv chromedriver /usr/local/bin/chromedriver \
        && sudo chmod +x /usr/local/bin/chromedriver \
        && chromedriver --version

It also takes less time than apt-get install chromium-chromedriver.

I am currently looking to use GitHub Actions to test a WebDriver binding and need it for C.I.
Currently, my plan is to include the Docker image selenium/standalone-chrome and run a the container for testing and documentation purposes.

I just tried github action on my project again (was missing chromedriver the last time) and it seem to be working without any special steps now, I guess it have been added to base image?

this is now deployed everywhere.

@alepauly
This isn't working as I would have expected
My expectation was that the environment variable CHROMEWEBDRIVER would point to the folder that contains Chrome Driver and not the actual executable file

On Windows the environment variable CHROMEWEBDRIVER points to C:\SeleniumWebDrivers\ChromeDriver i.e. a folder
and the documentation indicates it should be a folder https://docs.microsoft.com/en-us/azure/devops/pipelines/test/continuous-test-selenium?view=azure-devops#decide-how-you-will-deploy-and-test-your-app

Thank you for adding ChromeDriver on Ubuntu 18. However, the ChromeDriver provided does not match the pre-installed Google Chrome version. These two need to match in order for ChromeDriver to use the correct interfaces. Otherwise certain functions will fail.

ChromeDriver Version: 79.0.3945.36
Google Chrome Version: 79.0.3945.130

I understand that the latest ChromeDriver version on the official website hasn't been released yet, but in that case, until it is released, it's worth not updating Google Chrome. Otherwise ChromeDriver is useless and tests/automations will start failing.

Hello @jahed, thank you for your response, as described in documentation: Each version of ChromeDriver supports Chrome with matching major, minor, and build version numbers. For example, ChromeDriver 73.0.3683.20 supports all Chrome versions that start with 73.0.3683. It is not required to have equal patch version.

Thanks, I fell for a red herring. I assumed Fedora's approach (the distro I use) was standard since their build numbers for Chromium and ChromeDriver match on every new release, but that isn't the case. Probably just a result of them building them in the same process.

I'll continue testing other pieces to find the culprit. Really difficult when something suddenly stops working on GitHub's runners but works everywhere else. It's a bit of a black blox. 馃槗

It would help if this software list page was kept up-to-date and versioned like a wiki so we'd know when things change (e.g. Google Chrome is still on 78 and there's no ChromeDriver under Ubuntu environments).

Thanks again.

Update: I literally changed nothing and it's working now. Putting it down to something in GitHub's runner environment, whatever it is.

@jahed - sorry for the out of date docs, we've been working on improving that. For now the best source is to look at either at the readme files in master which are updated when the rollout of an image is complete, or the linked readmes through the badges in our repo readme which will link to the version currently rolling out. It takes about a week for a new image to make it through to all customers.

Getting the following error when running my system specs. I think it's somehow related to this. Any suggestions would be welcomed.

Selenium::WebDriver::Error::UnknownError:
            unknown error: Chrome failed to start: exited abnormally
              (unknown error: DevToolsActivePort file doesn't exist)
              (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

We updated CHROMEWEBDRIVER variable to point to chromedriver folder. Changes will be deployed next image rollouts.

Hello @lorman, please feel free to open separate issue if you have repro steps and need help with investigation.

Hello, variable CHROMEWEBDRIVER was updated to all linux images. If you'll face with issue please feel free to reactivate it.

Hey @dmitry-shibanov I am also getting @lorman's error:

Selenium::WebDriver::Error::UnknownError:
            unknown error: Chrome failed to start: exited abnormally
              (unknown error: DevToolsActivePort file doesn't exist)
              (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

I've tried manually installing ChromeDriver but that didn't do anything. I'm using ubuntu-latest for the image. Is there a configuration I have to explicitly set somewhere?

Edit: You can ignore this comment. After about 20 hair-pulling hours I fixed a multitude of syntax errors in my code.

I am getting this issue. I have a Rails app using Capybara to run integration tests, and I hit this error during execution on ubuntu-latest:

Chrome failed to start: exited abnormally.
        (unknown error: DevToolsActivePort file doesn't exist)
        (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.) (Selenium::WebDriver::Error::UnknownError)

Please advise with anything I can try to get this working.

@stevehobbsdev , could you please log the separate issue to track your problem?
Also If it is possible to provide any repro steps, it will significantly simplify our investigation

@maxim-lobanov Thanks, I created #506

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shogo82148 picture shogo82148  路  3Comments

raulpopadineti picture raulpopadineti  路  3Comments

frankieroberto picture frankieroberto  路  4Comments

ydnar picture ydnar  路  3Comments

trajano picture trajano  路  3Comments