Skip to content

Commit

Permalink
Fall back on last known good version of chromedriver
Browse files Browse the repository at this point in the history
Sometimes the version is not 'good' and the driver cannot match.
So try the matching driver first, and if we get a 404 then try
the last known good patch for this minor version. Resolves #453.
  • Loading branch information
kwinkunks committed Jan 9, 2024
1 parent d4f783e commit d3b73d2
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions ci/testkomodo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,23 @@ start_tests () {
start_integration_test () {

chromium_version=$(chromium-browser --version | grep -zoP '\d+\.\d+\.\d+\.\d+')
chromium_major_version=$(echo $chromium_version | grep -zoP '^\d+')
chromium_minor_version=$(echo $chromium_version | grep -zoP '^\d+\.\d+\.\d+')

echo "Downloading chromedriver v$chromium_version for chromium-browser v$chromium_version"
wget -O chromedriver.zip https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/$chromium_version/linux64/chromedriver-linux64.zip
# Sometimes the chromium-browser has no matching chromedriver.
# Check for HTTP 404 error
download_url="https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/$chromium_version/linux64/chromedriver-linux64.zip"
download_status=$(curl --head "$download_url" | grep 'HTTP/2 200')

driver_version=$chromium_version
if [[ -z "$download_status" ]]; then
# If 404 error, get last good driver version instead.
googlechromelabs_url='https://googlechromelabs.github.io/chrome-for-testing/latest-patch-versions-per-build.json'
driver_version=$(curl -s "$googlechromelabs_url" | jq -r .builds.\"$chromium_minor_version\".version)
download_url="https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/$driver_version/linux64/chromedriver-linux64.zip"
fi

echo "Downloading chromedriver v$driver_version for chromium-browser v$chromium_version"
wget -O chromedriver.zip "$download_url"
unzip -j chromedriver.zip chromedriver-linux64/chromedriver -d ../test-kenv/root/bin

pip install pytest selenium dash[testing]
Expand Down

0 comments on commit d3b73d2

Please sign in to comment.