Option 0: Download from the official page (preferred)
- Open https://googlechromelabs.github.io/chrome-for-testing/ Show archive.org snapshot
- In Section "Stable" > chromedriver / linux64 > Download ZIP from URL
- Take the
chromedriver
binary from the ZIP file and put it e.g. into~/bin
.
Chromedriver must be available in your path. You can add ~/bin
to your path like this:
echo "export PATH=$PATH:$HOME/bin" >> $HOME/.bash_profile
If you're also using Geordi, disable automatic updating of chromedriver in ~/.config/geordi/global.yml
:
auto_update_chromedriver: false
Option 1: Use Geordi
Warning
This geordi command is currently broken Show archive.org snapshot (for geordi releases < 9.6.1. You can update geordi with
gem update geordi
).
The geordi Show archive.org snapshot gem can upgrade to the correct version of chromedriver:
geordi chromedriver-update
Geordi can also be configured to automatically update chromedriver each time you run tests. For that, edit the global configuration file ~/.config/geordi/global.yml
and add the line
auto_update_chromedriver: true
Chromedriver must be available in your path. You can add ~/bin
to your path like this:
echo "export PATH=$PATH:$HOME/bin" >> $HOME/.bash_profile
Option 2: Use apt source
Warning
Wo no longer recommend this option. After a chrome update, the chromedriver package sometimes lags behind and is not compatible.
Install via
apt install chromium-chromedriver
Option 3: Install via npm
Warning
Wo no longer recommend this option. After a chrome update, the chromedriver package sometimes lags behind and is not compatible.
There's a handy npm package Show archive.org snapshot .
sudo npm -g install chromedriver
ln -sf /usr/lib/node_modules/chromedriver/lib/chromedriver/chromedriver ~/bin/chromedriver
Option 4: Shell script
Warning
This shell script hasn't been maintained for a while.
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="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:
$ 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})