Last active
August 29, 2015 14:13
-
-
Save danbruder/f64930d278d999a0d0e7 to your computer and use it in GitHub Desktop.
Install Selenium Server on OSX
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
#!/bin/sh | |
run () { | |
RELEASE="2.44" | |
PREFIX="/usr/local/lib" | |
JAR_URL="http://selenium-release.storage.googleapis.com/${RELEASE}/selenium-server-standalone-${RELEASE}.0.jar" | |
PLIST_URL="https://gist.githubusercontent.com/danbruder/f64930d278d999a0d0e7/raw/4b9792774a4d91b22745b6679a42677bded153d3/selenium.plist" | |
# Unload running process | |
if launchctl list | grep -q "selenium"; then | |
echo "unloading old process" | |
launchctl unload ${HOME}/Library/LaunchAgents/selenium.plist | |
fi | |
# Remove old symlinks if need be | |
if [ -L "/usr/local/lib/selenium-server.jar" ]; then | |
echo "unlinking jar" | |
unlink /usr/local/lib/selenium-server.jar | |
fi | |
# Remove old plist if need be | |
if [ -L "${HOME}/Library/LaunchAgents/selenium.plist" ]; then | |
echo "unlinking plist" | |
unlink ${HOME}/Library/LaunchAgents/selenium.plist | |
fi | |
# Remove old installation | |
if [ -d "${HOME}/.selenium" ]; then | |
echo "removing old selenium intall" | |
rm -rf ${HOME}/.selenium | |
fi | |
echo "downloading selenium server" | |
mkdir ${HOME}/.selenium | |
curl --progress-bar --fail ${JAR_URL} > ${HOME}/.selenium/selenium-server.jar | |
curl -s $PLIST_URL > ${HOME}/.selenium/selenium.plist | |
# Link to selenium jar file | |
echo "linking jar" | |
ln -s ${HOME}/.selenium/selenium-server.jar /usr/local/lib/selenium-server.jar | |
# Link plist | |
echo "linking plist" | |
ln -s ${HOME}/.selenium/selenium.plist ${HOME}/Library/LaunchAgents/selenium.plist | |
# Load plist | |
launchctl load ${HOME}/Library/LaunchAgents/selenium.plist | |
echo "You're all set! Selenium is running on port 4444." | |
} | |
run |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>selenium</string> | |
<key>RunAtLoad</key> | |
<true/> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/usr/bin/java</string> | |
<string>-jar</string> | |
<string>/usr/local/lib/selenium-server.jar</string> | |
</array> | |
<key>ServiceDescription</key> | |
<string>Selenium Server</string> | |
</dict> | |
</plist> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment