aboutsummaryrefslogtreecommitdiff
path: root/0003_download_chromedriver.sh
blob: de8cae25bae529cab4917d2eb2b9e435c3d57428 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/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