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…
@ashnazg
Copy link

ashnazg commented May 9, 2017

What version of phantomjs does this work properly for? I see these failures when trying to run the phantom line:

v2.1.1:

> .\phantomjs-2.1.1.exe --webdriver=8080 --webdriver-selenium-grid-hub=http://127.0.0.1:4445
[INFO  - 2017-05-09T20:59:12.209Z] GhostDriver - Main - running on port 8080
[INFO  - 2017-05-09T20:59:12.218Z] GhostDriver - Main - registering to Selenium HUB 'http://127.0.0.1:4445' version:  using '127.0.0.1:8080' with org.openqa.grid.selenium.proxy.DefaultRemoteProxy as remote proxy.
[ERROR - 2017-05-09T20:59:12.248Z] GhostDriver - main.fail - {"line":97,"sourceURL":"phantomjs://platform/hub_register.js","stack":"register@phantomjs://platform/hub_register.js:97:79\nglobalcode@phantomjs://code/main.js:78:37"}

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

v2.0.0:

> phantomjs-2.0.0.exe --webdriver=8080 --webdriver-selenium-grid-hub=http://127.0.0.1:4445
[INFO  - 2017-05-09T20:56:41.952Z] GhostDriver - Main - running on port 8080
[INFO  - 2017-05-09T20:56:41.960Z] GhostDriver - Main - registering to Selenium HUB 'http://127.0.0.1:4445' version:  using '127.0.0.1:8080' with org.openqa.grid.selenium.proxy.DefaultRemoteProxy as remote proxy.
[ERROR - 2017-05-09T20:56:41.992Z] GhostDriver - main.fail - {"line":96,"sourceURL":"","stack":"\tat \n\tat global code (:/ghostdriver/main.js:78:37)"}

  :262 in error

(I conceded my hub runs on 4445 rather than 4444, but that seems to be irrelevant to the errors)

@lawred2
Copy link

lawred2 commented Sep 27, 2017

I see the exact same as ashnazg - I can't get phantomjs to register with selenium grid. Exact same failure signature

[INFO  - 2017-05-09T20:56:41.952Z] GhostDriver - Main - running on port 8080
[INFO  - 2017-05-09T20:56:41.960Z] GhostDriver - Main - registering to Selenium HUB 'http://127.0.0.1:4445' version:  using '127.0.0.1:8080' with org.openqa.grid.selenium.proxy.DefaultRemoteProxy as remote proxy.
[ERROR - 2017-05-09T20:56:41.992Z] GhostDriver - main.fail - {"line":97,"sourceURL":"phantomjs://platform/hub_register.js","stack":"register@phantomjs://platform/hub_register.js:97:79\nglobalcode@phantomjs://code/main.js:78:37"}

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

Was this picked up? Anyone looking at it?

@phamtantho
Copy link

I have the same issue.
[INFO - 2017-10-21T11:39:22.232Z] GhostDriver - Main - running on port 8080
[INFO - 2017-10-21T11:39:22.238Z] GhostDriver - Main - registering to Selenium HUB 'http://127.0.0.1:4444' version: using '127.0.0.1:8080' with org.openqa.grid.selenium.proxy.DefaultRemoteProxy as remote proxy.
[ERROR - 2017-10-21T11:39:22.256Z] 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

Does anyone working on this issue?

@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