-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget-latest-chromedriver.sh
executable file
·25 lines (23 loc) · 1.13 KB
/
get-latest-chromedriver.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
PLATFORM='linux64'
TMPFILE="/tmp/chrome-for-testing.$$.html"
DRIVERFILE='/tmp/chromedriver-linux64.zip'
URL='https://googlechromelabs.github.io/chrome-for-testing/'
curl -sko $TMPFILE $URL
echo "Examine $TMPFILE"
VERSION=$(xmllint --htmlout --html --xpath "//div[@class='table-wrapper summary']/table/tbody/tr[th/a/text()='Stable']/td[1]/code/text()" $TMPFILE 2>/dev/null)
echo "About to download chromedriver version $VERSION"
DRIVERURL=$(xmllint --htmlout --html --xpath "//section[@id='stable']/div[@class='table-wrapper']/table/tbody/tr[th/code='chromedriver' and td/code='200' and th/code='$PLATFORM']/td[1]/code/text()" $TMPFILE 2>/dev/null)
rm -f $TMPFILE
echo "About to download chromedriver URL $DRIVERURL"
curl -sko $DRIVERFILE $DRIVERURL
echo "Verify contents of $DRIVERFILE"
unzip -t $DRIVERFILE
#
# https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/119.0.6045.105/linux64/chromedriver-linux64.zip
# echo unzip -d '/tmp/' -u $DRIVERFILE
rm -fr /tmp/chromedriver-linux64
unzip -d '/tmp/' -u $DRIVERFILE
cp /tmp/chromedriver-linux64/chromedriver "$HOME/Downloads"
"$HOME/Downloads/chromedriver" -version
rm -f $DRIVERFILE