Last active
January 24, 2025 15:25
-
-
Save DerekChia/d8b30e035def0ce875ff45ae6b2002f5 to your computer and use it in GitHub Desktop.
Install Chromium, ChromeDriver and Selenium on Ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Reference : https://gist.github.com/ziadoz/3e8ab7e944d02fe872c3454d17af31a5#file-install-sh | |
# Versions (Update SELENIUM_STANDALONE_VERSION to the version of your choice) | |
CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE` | |
SELENIUM_STANDALONE_VERSION=3.13.0 | |
SELENIUM_SUBDIR=$(echo "$SELENIUM_STANDALONE_VERSION" | cut -d"." -f-2) | |
# Remove existing downloads and binaries so we can start from scratch. | |
sudo apt-get remove google-chrome-stable | |
rm ~/selenium-server-standalone-*.jar | |
rm ~/chromedriver_linux64.zip | |
sudo rm /usr/local/bin/chromedriver | |
sudo rm /usr/local/bin/selenium-server-standalone.jar | |
# Install dependencies. | |
sudo apt-get update | |
sudo apt-get install -y unzip openjdk-8-jre-headless xvfb libxi6 libgconf-2-4 | |
# Install pip | |
sudo apt-get install -y python3-pip | |
sudo pip3 install --upgrade pip | |
sudo pip3 install selenium requests beautifulsoup4 | |
# Install Chrome. | |
sudo curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add | |
sudo echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list | |
sudo apt-get -y update | |
sudo apt-get -y install chromium-browser | |
# Install ChromeDriver. | |
wget -N http://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip -P ~/ | |
unzip ~/chromedriver_linux64.zip -d ~/ | |
rm ~/chromedriver_linux64.zip | |
sudo mv -f ~/chromedriver /usr/local/bin/chromedriver | |
sudo chown root:root /usr/local/bin/chromedriver | |
sudo chmod 0755 /usr/local/bin/chromedriver | |
# Install Selenium. | |
wget -N http://selenium-release.storage.googleapis.com/$SELENIUM_SUBDIR/selenium-server-standalone-$SELENIUM_STANDALONE_VERSION.jar -P ~/ | |
sudo mv -f ~/selenium-server-standalone-$SELENIUM_STANDALONE_VERSION.jar /usr/local/bin/selenium-server-standalone.jar | |
sudo chown root:root /usr/local/bin/selenium-server-standalone.jar | |
sudo chmod 0755 /usr/local/bin/selenium-server-standalone.jar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
5/12/24 for debian 12: this code works if: