Skip to content

Instantly share code, notes, and snippets.

@thefotios
Created September 28, 2011 14:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thefotios/1248097 to your computer and use it in GitHub Desktop.
Save thefotios/1248097 to your computer and use it in GitHub Desktop.
Script to deploy selenium on Fedora machines
#!/bin/bash
#
# This script should allow for selenium to be run on a headless Fedora box and connect to a hub server
#
# Author: Fotios Lindiakos (fotios at redhat.com)
EPHEMERAL_DIR="/usr/local/bin"
SELENIUM_DIR="/usr/lib/selenium"
HUB_SERVER="http://ec2-107-20-156-96.compute-1.amazonaws.com:4444"
# Function to get most recent version of a gist
get_gist() {
curl https://api.github.com/gists/$1 | grep -Po '"raw_url":.*?[^\\]",' | awk -F\" '{print $4}' | xargs curl -L -O
}
# update packages
yum update;
yum install xorg-x11-server-Xvfb firefox java-1.6.0-openjdk;
# Fetch ephemeral-x
if [ ! -f $EPHEMERAL_DIR/ephemeral-x ]
then
pushd $EPHEMERAL_DIR;
curl -o ephemeral-x https://raw.github.com/jordansissel/xdotool/master/t/ephemeral-x.sh;
chmod +x ephemeral-x;
popd;
fi
# Create a selenium folder
if [ ! -f $SELENIUM_DIR/selenium-server.jar ]
then
mkdir $SELENIUM_DIR;
pushd $SELENIUM_DIR;
curl -O http://selenium.googlecode.com/files/selenium-server-standalone-2.7.0.jar;
# Get the config.json for selenium
get_gist "1248070"
ln -s selenium-server-standalone-2.7.0.jar selenium-server.jar;
popd;
fi
# Doesn't work properly
# Get the selenium init script and add it to startup
#pushd /etc/init.d/
#get_gist "1248075"
#chmod +x selenium;
#popd;
#chkconfig --add selenium;
# Run this command locally
echo "$EPHEMERAL_DIR/ephemeral-x java -jar $SELENIUM_DIR/selenium-server.jar -role webdriver -hub $HUB_SERVER -nodeConfig $SELENIUM_DIR/config.json -log selenium.log &> /dev/null &"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment