Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#!/usr/bin/env bash
# ===================================================
# Start Setup
# ===================================================
cd ~/
# Update yum
sudo yum -y update
# ===================================================
# Start install of the Selenuim stack
# * Selenium stand alone server
# * Firefox
# * Xvfb
# ===================================================
# borrowed from
set -e
if [ -e /.sssInstalled ]; then
echo 'Already installed.'
echo ''
echo '----------'
# Install Java, firefox, Xvfb, and unzip
sudo yum -y install java-1.8.0-openjdk-headless.x86_64
sudo yum -y install xorg-x11-server-Xvfb.x86_64
sudo yum -y install dbus
cd /usr/local
sudo rm firefox.tar.bz2 || true
sudo wget -O firefox.tar.bz2
sudo tar xvjf firefox.tar.bz2
sudo rm /usr/bin/firefox || true
sudo ln -s /usr/local/firefox/firefox /usr/bin/firefox
sudo rm firefox.tar.bz2
firefox -v
# get fonts so that firefox doesn't freak out that it's missing fonts for display
sudo yum -y install dejavu-lgc-sans-fonts
# setup machine Id, firefox needs this machine id
sudo mkdir /var/lib/dbus || true
sudo touch /var/lib/dbus/machine-id || true
echo `dbus-uuidgen` | sudo tee /var/lib/dbus/machine-id
# Download and copy the ChromeDriver to /usr/local/bin
cd /tmp
if [ ! -d "/var/selenium" ]; then
sudo mkdir /var/selenium
# get selenium server latest release
wget -O selenium-server-standalone.jar
sudo mv selenium-server-standalone.jar /var/selenium
# So that running `vagrant provision` doesn't redownload everything
sudo touch /.sssInstalled
# ===================================================
# Start Xvfb, firefox, and Selenium in the background
# ===================================================
cd ~/
# do check to see if selenium server is already running
sudo sudo rm /.sss || true
sudo curl ${seleniumStatus} -o /.sss -f || echo -e "SELENUIM NOT RUNNING" | sudo tee /.sss
seleniumRunning=`cat /.sss`
if grep -q OK <<<${seleniumRunning}; then
echo "Selenium Server is already running, returned '$seleniumRunning'."
# Start up the Selenium Server in the background
echo "Starting Selenium ..."
cd /var/selenium
sudo rm ./selenium.log || true
sudo touch ./selenium.log
sudo chmod 777 ./selenium.log
export DISPLAY=:10
Xvfb :10 +extension RANDR -screen 0 1366x768x24 -ac -extension RANDR &
nohup xvfb-run java -jar ./selenium-server-standalone.jar > selenium.log &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.