#!/bin/bash ## Simple Gentoo-compatible script to download the latest chromedriver binary set -euo pipefail chrome_version="${CHROME_VERSION:-$(equery list -F '$version' google-chrome)}" platform="linux64" # no other linux variants seem to be published tmpdir="${TMPDIR:-/tmp}" chrome_version_list="${tmpdir}/chrome-versions.json" download_location="${tmpdir}/chrome-${chrome_version}.zip" wget -O $chrome_version_list https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json download_url=$(cat $chrome_version_list | jq -r '.versions[] | select(.version == "'"$chrome_version"'").downloads.chromedriver[] | select(.platform == "'"$platform"'").url') wget -O $download_location $download_url echo "Unzip the [chromedriver] from [$download_location] and place in your path:" echo "> unzip -j $download_location chromedriver-linux64/chromedriver" echo "Verify by running it: [> chromedriver --port=9515]" unzip -l $download_location