I've got a Node script that I want to use the child_process
module with to get a Selenium server running with PhantomJS's GhostDriver.
I've required the module:
Child = require "child_process"
And here's how I'm trying to start the server and attach GD to it (in Coffeescript):
@Selenium = new Child.exec "java -jar selenium/selenium-server-standalone-2.44.0.jar -role hub -port 4444", (error, stdout, stderr) =>
console.log stdout
console.log error if error
@PhantomJS = new Child.exec "phantomjs --webdriver=8080 --webdriver-selenium-grid-hub=http://127.0.0.1:4444", (error, stdout, stderr) =>
console.log stdout
console.log error if error
The stdout
for @PhantomJS
is this:
PhantomJS is launching GhostDriver...
[ERROR - 2014-12-10T18:51:27.587Z] GhostDriver - main.fail - {"message":"Could not start Ghost Driver","line":82,"sourceId":4469911104,"sourceURL":":/ghostdriver/main.js","stack":"Error: Could not start Ghost Driver\n at :/ghostdriver/main.js:82","stackArray":[{"sourceURL":":/ghostdriver/main.js","line":82}]}
Additionally, I get this error from that command: {"killed": false, "code": 1, "signal": null}
Some notes:
- The Selenium jar file is in fact located at selenium/selenium-server-standalone-2.44.0.jar
- I've tried
npm update
ing just to see if that would make a difference - It occurred to me that something else might be running on port 4444, so I went ahead and ran
"PORT_NUMBER=4444 | lsof -i tcp:${PORT_NUMBER} | awk 'NR!=1 {print $2}' | xargs kill"
to no avail - I've tried installing PhantomJS from the source as per this suggestion to the same error
- If I run these commands separately, outside of the script, it all works fine