PhantomJS sometimes crashes
See original GitHub issueI have been successfully running a fairly comprehensive suite of Protractor e2e tests using Chrome on OSX (Mavericks: 10.9.2).
We have a technical requirement to run these tests headlessly, so I swapped in PhantomJS instead of Chrome, and after 20 seconds (consistently), I get the following error:
Runner Process Exited With Error Code: 8
Fatal error: protractor exited with code: 1
Now for some more detailed information.
Here is the full error output from the grunt
task I am running:
Running "protractor:phantomjs" (protractor) task
------------------------------------
PID: 9678 (capability: phantomjs #1)
------------------------------------
Starting selenium standalone server...
Selenium standalone server started at http://192.168.1.111:4444/wd/hub
/path/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1562
throw error;
^
UnknownError: null
at new bot.Error (/path/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:109:18)
at Object.bot.response.checkResponse (/path/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/response.js:106:9)
at /path/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:135:24
at /path/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1178:15
at webdriver.promise.ControlFlow.runInNewFrame_ (/path/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1455:20)
at notify (/path/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:328:12)
at notifyAll (/path/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:297:7)
at fulfill (/path/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:402:7)
at /path/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1178:15
at webdriver.promise.ControlFlow.runInNewFrame_ (/path/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1455:20)
==== async task ====
WebDriver.createSession()
at Function.webdriver.WebDriver.acquireSession_ (/path/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:132:49)
at Function.webdriver.WebDriver.createSession (/path/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:111:30)
at Builder.build (/path/node_modules/protractor/node_modules/selenium-webdriver/builder.js:105:20)
at LocalDriverProvider.getDriver (/path/node_modules/protractor/lib/driverProviders/local.dp.js:128:9)
at /path/node_modules/protractor/lib/runner.js:327:35
at _fulfilled (/path/node_modules/protractor/node_modules/q/q.js:797:54)
at self.promiseDispatch.done (/path/node_modules/protractor/node_modules/q/q.js:826:30)
at Promise.promise.promiseDispatch (/path/node_modules/protractor/node_modules/q/q.js:759:13)
at /path/node_modules/protractor/node_modules/q/q.js:573:44
[launcher] Runner Process Exited With Error Code: 8
>>
Fatal error: protractor exited with code: 1
Package versions:
"grunt-protractor-runner": "~0.2.3"
"protractor": "0.19.0"
"selenium-webdriver": "~2.40"
Contents of protractor.conf.js
:
exports.config = {
seleniumServerJar: '../../node_modules/protractor/selenium/selenium-server-standalone-2.39.0.jar',
seleniumPort: 4444,
seleniumArgs: ['-browserTimeout=60'],
specs: [
'../e2e/utils.js',
'../e2e/**/*-suite.js'
],
capabilities: {
browserName: 'phantomjs',
'phantomjs.binary.path': './node_modules/karma-phantomjs-launcher/node_modules/phantomjs/bin/phantomjs',
'phantomjs.cli.args': ['--debug=true', '--webdriver', '--webdriver-logfile=webdriver.log', '--webdriver-loglevel=DEBUG']
},
baseUrl: 'http://localhost:9292',
rootElement: 'body',
onPrepare: function () {
require('jasmine-reporters');
jasmine.getEnv().addReporter(new jasmine.JUnitXmlReporter('test/results/', true, true));
},
framework: 'jasmine',
jasmineNodeOpts: {
onComplete: function () {
},
isVerbose: true,
showColors: true,
includeStackTrace: true,
defaultTimeoutInterval: 30000
}
};
I have tried installing version ~1.9.7-1
of the phantomjs
package independently of the one that protractor
depends upon, and updating the phantomjs.binary.path
property in protractor.conf.js
, but I get the same result.
After spending far too long debugging the JS to try to isolate where the error is occurring, I know that it is falling over in runner.js
.
Specifically in Runner.prototype.runJasmine_()
, the anonymous function passed to webdriver.promise.controlFlow().execute()
here is never executed.
Can anyone help?
Let me know if you need more information.
Matt
Issue Analytics
- State:
- Created 10 years ago
- Comments:61 (27 by maintainers)
Top GitHub Comments
I’ll go ahead and close the loop here because upgrading to PhantomJS 2 resolves this 👏 👏 🎊 🎺
I’d also like to restate what Julie mentioned earlier:
If anyone encounters additional issues with Phantom, please try to raise an issue on the Phantom queue and resolve it there. Thanks, y’all are awesome! 😺
Yes, this is fixed by upgrade to PhantomJS 2 https://github.com/detro/ghostdriver/issues/328#issuecomment-44309690