Posted 4 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).

#!/bin/bash VERSION_URL="" 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-$" echo "Downloading to $ZIPFILEPATH" curl -f --silent "$VERSION/" > "$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:

$ update-chromedriver Current version is 77.0.3865.40 Downloading to /tmp/ 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})
Growing Rails Applications in Practice
Check out our new e-book:
Learn to structure large Ruby on Rails codebases with the tools you already know and love.

Owner of this card:

Arne Hartherz
Last edit:
3 months ago
by Emanuel De
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 cookies to improve usability and analyze traffic.
Accept or learn more