Skip to content

Instantly share code, notes, and snippets.

@revington
Last active April 12, 2018 17:59
Show Gist options
  • Save revington/5858300 to your computer and use it in GitHub Desktop.
Save revington/5858300 to your computer and use it in GitHub Desktop.
launch selenium grid + phantomjs
#!/usr/bin/env sh
trap 'killall' INT
killall() {
trap '' INT TERM # ignore INT and TERM while shutting down
echo "**** Shutting down... ****" # added double quotes
kill -TERM 0 # fixed order, send TERM not INT
wait
echo DONE
}
hub="java -jar selenium-server-standalone-2.37.0.jar -role hub"
node="java -jar selenium-server-standalone-2.37.0.jar -role node -hub http://localhost:4444/grid/register"
phantom="phantomjs --webdriver=8080 --webdriver-selenium-grid-hub=http://127.0.0.1:4444"
chrome="java -Dwebdriver.chrome.driver=./chromedriver -jar selenium-server-standalone-2.37.0.jar -role webdriver -hub http://localhost:4444/grid/register -port 5556 -browser browserName=chrome,maxInstances=10"
opera="java -Dwebdriver.opera.driver=./operadriver-v1.1/operadriver-v1.1.jar -jar selenium-server-standalone-2.37.0.jar -role webdriver -hub http://localhost:4444/grid/register -port 5557 -browser browserName=opera"
${hub} &
echo '3'
sleep 1
echo '2'
sleep 1
echo '1'
sleep 1
echo 'registering drivers'
${node} &
${phantom} &
${chrome} &
${opera} &
cat #wait forever…
@moreirasantos
Copy link

+1
Any news on this?

$ phantomjs --webdriver=5555 --webdriver-selenium-grid-hub=http://localhost:4444/
[INFO - 2018-04-12T17:56:12.038Z] GhostDriver - Main - running on port 5555
[INFO - 2018-04-12T17:56:12.039Z] GhostDriver - Main - registering to Selenium HUB 'http://localhost:4444/' version: using '127.0.0.1:5555' with org.openqa.grid.selenium.proxy.DefaultRemoteProxy as remote proxy.
[ERROR - 2018-04-12T17:56:12.043Z] GhostDriver - main.fail - {"line":97,"sourceURL":"phantomjs://platform/hub_register.js","stack":"register@phantomjs://platform/hub_register.js:97:79\nglobal code@phantomjs://code/main.js:78:37"}

phantomjs://platform/console++.js:263 in error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment