Skip to content

Commit

Permalink
Fallback latest version
Browse files Browse the repository at this point in the history
Fixes #200
  • Loading branch information
nanasess committed Aug 4, 2023
1 parent 788c980 commit 835fd4b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/setup-chromedriver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ else

echo "Installing ChromeDriver $VERSION for $ARCH"
URL=$(curl --location --fail --retry 10 https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json | jq -r ".versions[] | select(.version == \"${VERSION}\") | .downloads.chromedriver[] | select(.platform == \"${ARCH}\") | .url")
if [ "$URL" == "" ]; then
echo "Fallback to latest version of ChromeDriver for $ARCH"
VERSION=$(curl --location --fail --retry 10 https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json | jq -r ".versions[] | select(.version | startswith(\"$(echo $VERSION | cut -d '.' -f1-3).\")) | .version" | tail -1)
URL=$(curl --location --fail --retry 10 https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json | jq -r ".versions[] | select(.version == \"${VERSION}\") | .downloads.chromedriver[] | select(.platform == \"${ARCH}\") | .url")
echo "Installing ChromeDriver $VERSION for $ARCH"
fi
echo "Downloading $URL"
curl --location --fail --retry 10 -O "$URL"
unzip -o -q chromedriver-${ARCH}.zip
Expand Down

0 comments on commit 835fd4b

Please sign in to comment.