-
-
Save wyattbarrett/b685f8c028fb62d178266ce31ac3ef4d to your computer and use it in GitHub Desktop.
Setting up Selenium as a Service in OS X
This file contains 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 | |
if [ ! -d /usr/local/selenium/ ]; then | |
sudo mkdir /usr/local/selenium/ | |
fi | |
if [ ! -f /usr/local/selenium/selenium-server-standalone-3.11.0.jar ]; then | |
sudo curl -o /usr/local/selenium/selenium-server-standalone-3.11.0.jar https://selenium-release.storage.googleapis.com/3.11/selenium-server-standalone-3.11.0.jar | |
fi | |
if [ ! -d /var/log/selenium/ ]; then | |
sudo mkdir -p /var/log/selenium/ | |
fi | |
sudo chmod a+w /var/log/selenium/ | |
cp $PWD/seleniumHub.plist ~/Library/LaunchAgents/seleniumHub.plist | |
launchctl load ~/Library/LaunchAgents/seleniumHub.plist | |
launchctl start seleniumHub |
This file contains 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 | |
if [ ! -d /usr/local/selenium/ ]; then | |
sudo mkdir /usr/local/selenium/ | |
fi | |
if [ ! -f /usr/local/selenium/selenium-server-standalone-3.11.0.jar ]; then | |
sudo curl -o /usr/local/selenium/selenium-server-standalone-3.11.0.jar https://selenium-release.storage.googleapis.com/3.11/selenium-server-standalone-3.11.0.jar | |
fi | |
if [ ! -f /usr/local/selenium/chromedriver ]; then | |
sudo curl -o /usr/local/selenium/chromedriver_mac64.zip https://chromedriver.storage.googleapis.com/2.38/chromedriver_mac64.zip | |
sudo unzip /usr/local/selenium/chromedriver_mac64.zip | |
sudo rm /usr/local/selenium/chromedriver_mac64.zip | |
fi | |
if [ ! -d /var/log/selenium/ ]; then | |
sudo mkdir -p /var/log/selenium/ | |
fi | |
sudo chmod a+w /var/log/selenium/ | |
cp $PWD/seleniumHub.plist ~/Library/LaunchAgents/seleniumNode.plist | |
launchctl load ~/Library/LaunchAgents/seleniumNode.plist | |
launchctl start seleniumNode |
This file contains 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
java -Dwebdriver.chrome.driver="/usr/local/selenium/chromedriver" -jar /usr/local/selenium/selenium-server-standalone-3.11.0.jar -port 5555 -role node -hub http://{ip}:4444/grid/register -browser "browserName=chrome, maxInstances=8" |
This file contains 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>OnDemand</key> | |
<true/> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/usr/bin/java</string> | |
<string>-jar</string> | |
<string>/usr/local/selenium/selenium-server-standalone-3.11.0.jar</string> | |
<string>-port</string> | |
<string>4444</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> |
This file contains 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>OnDemand</key> | |
<true/> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/usr/bin/java</string> | |
<string>-jar</string> | |
<string>/usr/local/selenium/selenium-server-standalone-3.11.0.jar</string> | |
<string>-Dwebdriver.chrome.driver</string> | |
<string>/usr/local/selenium/chromedriver</string> | |
<string>-role</string> | |
<string>node</string> | |
<string>-port</string> | |
<string>5555</string> | |
<string>-browser</string> | |
<string>"browserName=chrome,maxInstances=8"</string> | |
<string>-hub</string> | |
<string>http://{hubip}:4444/grid/register</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