Skip to content

Instantly share code, notes, and snippets.

@dhrrgn
Last active August 24, 2018 13:06
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save dhrrgn/c2db3dbcc0ccc7dba500 to your computer and use it in GitHub Desktop.
Save dhrrgn/c2db3dbcc0ccc7dba500 to your computer and use it in GitHub Desktop.
Setting up Selenium as a Service in OS X
#!/usr/bin/env bash
if [ ! -d /usr/lib/selenium/ ]; then
sudo mkdir /usr/lib/selenium/
fi
if [ ! -f /usr/lib/selenium/selenium-server-standalone-2.41.0.jar ]; then
sudo curl -o /usr/lib/selenium/selenium-server-standalone-2.41.0.jar http://selenium-release.storage.googleapis.com/2.41/selenium-server-standalone-2.41.0.jar
fi
if [ ! -d /usr/lib/selenium/ ]; then
sudo mkdir -p /var/log/selenium/
fi
sudo chmod a+w /var/log/selenium/
cp $PWD/selenium.plist ~/Library/LaunchAgents/selenium.plist
launchctl load ~/Library/LaunchAgents/selenium.plist
launchctl start selenium
<?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>OnDemand</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/java</string>
<string>-jar</string>
<string>/usr/lib/selenium/selenium-server-standalone-2.41.0.jar</string>
<string>-port</string>
<string>4443</string>
</array>
<key>ServiceDescription</key>
<string>Selenium Server</string>
<key>StandardErrorPath</key>
<string>/var/log/selenium/selenium-error.log</string>
<key>StandardOutPath</key>
<string>/var/log/selenium/selenium-output.log</string>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment