Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

PhantomJS sometimes crashes #557

@mcalthrop

Description

@mcalthrop

I 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions