Posted 10 months ago. Visible to the public. Deprecated.

Linux: Shell script to easily update chromedriver

Please use geordi chromedriver-update for this task now

Updating Chromedriver is often a hassle: If you use chromium-chromedriver from the Ubuntu sources, it usually won't be updated when a new Chrome version is released. Manually downloading it from the official page is a very manual process. And I don't really want to use remote code like the "webdrives" gem because of paranoia.

Cry no more, for here is a tiny bash script that will download the latest chromedriver version and place it inside ~/bin. (If you use a different location, adjust accordingly).

Copy
#!/bin/bash VERSION_URL="https://chromedriver.storage.googleapis.com/LATEST_RELEASE" VERSION=$(curl -f --silent $VERSION_URL) if [ -z "$VERSION" ]; then echo "Failed to read current version from $VERSION_URL. Aborting." exit 1 else echo "Current version is $VERSION" fi # Abort script if any of the next commands fails. set -e set -o pipefail ZIPFILEPATH="/tmp/chromedriver-$VERSION.zip" echo "Downloading to $ZIPFILEPATH" curl -f --silent "https://chromedriver.storage.googleapis.com/$VERSION/chromedriver_linux64.zip" > "$ZIPFILEPATH" BINFILEPATH="$HOME/bin/chromedriver-$VERSION" echo "Extracting to $BINFILEPATH" unzip -p "$ZIPFILEPATH" chromedriver > "$BINFILEPATH" echo Setting execute flag chmod +x "$BINFILEPATH" echo Updating symlink ln -nfs "$BINFILEPATH" ~/bin/chromedriver echo Removing ZIP file rm "$ZIPFILEPATH" echo Done chromedriver -v

Simply place it wherever you place your shell scripts (I use ~/bin/update-chromedriver) and give execute permissions (e.g. via chmod +x ~/bin/update-chromedriver).

Then, whenever your Chrome is updated, run update-chromedriver and after one second you are ready to go.

Example output:

Copy
$ update-chromedriver Current version is 77.0.3865.40 Downloading to /tmp/chromedriver-77.0.3865.40.zip Extracting to /home/arne/bin/chromedriver-77.0.3865.40 Setting execute flag Updating symlink Removing ZIP file Done ChromeDriver 77.0.3865.40 (f484704e052e0b556f8030b65b953dce96503217-refs/branch-heads/3865@{#442})

makandra has been working exclusively with Ruby on Rails since 2007. Our laser focus on a single technology has made us a leader in this space.

Owner of this card:

Avatar
Arne Hartherz
Last edit:
5 months ago
by Jakob Scholz
Keywords:
geordi, chromedriver
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Arne Hartherz to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more