Auto update Chrome Selenium Webdriver

Posted on
Sat Jan 28, 2023 9:14 am
ryanbuckner offline
Posts: 1074
Joined: Oct 08, 2011
Location: Northern Virginia

Auto update Chrome Selenium Webdriver

I found this great script to auto update the Chrome Selenium webdriver when the Chrome version changes. Before today I was manually downloading and installing the webdriver after script failures. Check it out:

Code: Select all
#!/bin/sh
# Downloads chromedriver based on your current chrome version, unzips, deletes zip file


# Get current chrome version
# separate version from other output (cut...-f3)
# separate first 3 fields (segments) of the version number (cut...-f1-3)
# Pass version number into xargs/curl call
CHROME_VERSION=$(/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version | cut -d ' ' -f3 | cut -d '.' -f1-3 | xargs -I {} curl https://chromedriver.storage.googleapis.com/LATEST_RELEASE_{})

ZIP_FILE_NAME=chromedriver_mac64.zip
CD_FILE_NAME=chromedriver

# change the dir to the place you want to put the file
cd /Library/Application\ Support/Perceptive\ Automation/Python3-includes

# delete the old chromedriver 
rm $CD_FILE_NAME

# Insert CHROME_VERSION into download URL:
curl -o ./$ZIP_FILE_NAME "https://chromedriver.storage.googleapis.com/$CHROME_VERSION/chromedriver_mac64.zip"

# Unzip. -o flag means overwrite
unzip -o $ZIP_FILE_NAME

rm $ZIP_FILE_NAME

# Clean / remove quarantine for Apple in order to open it
xattr -d com.apple.quarantine chromedriver



credit to Jess Brown

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 5 guests

cron