aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x0003_download_chromedriver.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/0003_download_chromedriver.sh b/0003_download_chromedriver.sh
new file mode 100755
index 0000000..de8cae2
--- /dev/null
+++ b/0003_download_chromedriver.sh
@@ -0,0 +1,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
+