Skip to content

Instantly share code, notes, and snippets.

@diemol
Last active July 9, 2021 15:03
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save diemol/635f450672b5bf80420d595ca0016d20 to your computer and use it in GitHub Desktop.
Save diemol/635f450672b5bf80420d595ca0016d20 to your computer and use it in GitHub Desktop.
Geckodriver and Chromedriver installers for OSX/Mac
#!/bin/bash
# download and install latest chromedriver for linux or mac.
# required for selenium to drive a Chrome browser.
install_dir="/usr/local/bin"
version=$(wget -qO- https://chromedriver.storage.googleapis.com/LATEST_RELEASE)
if [[ $(uname) == "Darwin" ]]; then
url=https://chromedriver.storage.googleapis.com/$version/chromedriver_mac64.zip
elif [[ $(uname) == "Linux" ]]; then
url=https://chromedriver.storage.googleapis.com/$version/chromedriver_linux64.zip
else
echo "can't determine OS"
exit 1
fi
curl -s -L "$url" | tar -xz
chmod +x chromedriver
sudo mv chromedriver "$install_dir"
echo "installed chromedriver binary in $install_dir"
#!/bin/bash
# download and install latest geckodriver for linux or mac.
# required for selenium to drive a firefox browser.
install_dir="/usr/local/bin"
json=$(curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest)
if [[ $(uname) == "Darwin" ]]; then
url=$(echo "$json" | jq -r '.assets[].browser_download_url | select(contains("macos"))')
elif [[ $(uname) == "Linux" ]]; then
url=$(echo "$json" | jq -r '.assets[].browser_download_url | select(contains("linux64"))')
else
echo "can't determine OS"
exit 1
fi
curl -s -L "$url" | tar -xz
chmod +x geckodriver
sudo mv geckodriver "$install_dir"
echo "installed geckodriver binary in $install_dir"
@diemol
Copy link
Author

diemol commented Oct 9, 2017

Disclaimer

This Firefox/Geckodriver script was taken from https://gist.github.com/cgoldberg/4097efbfeb40adf698a7d05e75e0ff51, and the Chromedriver is basically a copy of it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment