[chromedriver] Fix package installation

This commit alllows us to switch to JSON endpoints for chromedriver
since upstream changed the way of installation for version 115 or newer:
https://chromedriver.chromium.org/downloads#h.p_ID_32
https://github.com/GoogleChromeLabs/chrome-for-testing#json-api-endpoints

Change-Id: I4a432ec36fe9e3f794cc6b7788bbdc04db3c8cf6
This commit is contained in:
astebenkova 2023-07-20 12:34:26 +03:00
parent 2542db1647
commit 027bcefbd4
1 changed files with 3 additions and 2 deletions

View File

@ -25,6 +25,7 @@
- unzip
- wget
- xvfb
- jq
- name: Install selenium
pip:
@ -55,8 +56,8 @@
shell: |-
set -ex
CHROME_VERSION=$(dpkg -s google-chrome-stable | grep -Po '(?<=^Version: ).*' | awk -F'.' '{print $1"."$2"."$3}')
DRIVER_PATH=$(wget -qO- https://chromedriver.storage.googleapis.com | grep -Po "(?<=<Key>)${CHROME_VERSION}[^<]*?chromedriver_linux64\.zip(?=</Key>)" | tail -1)
wget -O /tmp/chromedriver.zip "https://chromedriver.storage.googleapis.com/${DRIVER_PATH}"
DRIVER_URL=$(wget -qO- https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json | jq -r --arg chrome_version "$CHROME_VERSION" '.channels.Stable.downloads.chrome[] | select(.platform=="linux64" and (.url | test($chrome_version))).url')
wget -O /tmp/chromedriver.zip ${DRIVER_URL}
args:
executable: /bin/bash