-
-
Save 0D1NTR33/41d7a756bb2d13fccb3c4d4fbd6a4673 to your computer and use it in GitHub Desktop.
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
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
chrontab -e | |
# Start GoGreen Bot every 6 hours | |
0 */6 * * * python3 ~/go-green/bot.py >> ~/go-green/bot.log 2>&1 | |
# Start GoGreen Bot every 1 minute without overlapse | |
* * * * * /usr/bin/pgrep -f ~/go-green/bot.py >> ~/go-green/bot.log 2>&1 || python3 ~/go-green/bot.py >> ~/go-green/bot.log 2>&1 |
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 | |
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/ | |
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c | |
# http://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver | |
# http://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception | |
# http://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal | |
# http://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04 | |
# Versions | |
CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE` | |
SELENIUM_STANDALONE_VERSION=3.4.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 Chrome. | |
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - | |
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' | |
sudo apt-get update | |
sudo apt-get install google-chrome-stable | |
# 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 Server. | |
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 | |
# Install Python | |
sudo apt-get update | |
sudo apt-get -y upgrade | |
sudo apt autoremove | |
sudo apt-get install python3 | |
sudo apt-get install python3-pip | |
# Install Selenium module. | |
sudo pip3 install --upgrade pip | |
sudo pip3 install selenium |
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 | |
# Run Chrome via Selenium Server | |
start-chrome() { | |
xvfb-run java -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver -jar /usr/local/bin/selenium-server-standalone.jar | |
} | |
start-chrome-debug() { | |
xvfb-run java -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver -jar /usr/local/bin/selenium-server-standalone.jar -debug | |
} | |
# Run Chrome Headless | |
start-chrome-headless() { | |
chromedriver --url-base=/wd/hub | |
} | |
#Run test | |
test() { | |
echo "Test passed!" | |
} | |
"$@" | |
# Run | |
# start-chrome | |
# start-chrome-debug | |
# start-chrome-headless | |
# test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment