How to always download the latest version of chromedriver and geckodriver?



Running automation tests on our CI. Currently, we are retrieving the latest versions of Chrome and Firefox as part of our setup, however, the versions of chromedriver and geckodriver we use are hardcoded because there seems to be no link to the latest version.

Ex. here is the line that downloads the latest firefox version

wget -nv -O ~/FirefoxSetup.tar.bz2 ""

While here is the line that downloads a specific version of geckodriver

wget -nv -O ~/geckodriver.tar.gz ""

Is there anyway to always get the latest chromedriver and geckodriver?


Check if this gist helps, at least for chromedriver:

download_location= " $version / "
rm /tmp/
wget -P /tmp $download_location
unzip /tmp/ -d .
mv ./chromedriver ./chromedriver.linux
chmod u+x ./chromedriver.linux

Same idea for geckodriver:

install_dir= " /usr/local/bin "
json= $( curl -s )
if [[ $( uname )  ==  " Darwin " ]] ;  then
url= $( echo " $json "  | jq -r ' .assets[].browser_download_url | select(contains("maces")) ' )
elif [[ $( uname )  ==  " Linux " ]] ;  then
url= $( echo " $json "  | jq -r ' .assets[].browser_download_url | select(contains("linux64")) ' )
 echo  " can't determine OS "
 exit 1
curl -s -L " $url "  | tar -xz
chmod +x geckodriver
sudo mv geckodriver " $install_dir "

Answered By – VonC

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More