Search code examples
javascriptphantomjsgulpprotractorghostdriver

PhantomJS ghostdriver stops


I'm trying to run an e2e-test on my laptop using phantomjs, ghostdriver and protractor. I run the following commands:

  • phantomjs --webdriver=5000
  • gulp protractor

When I run the first command, everything looks fine, but as soon as I run the second command, phantomjs.exe crashes (just stops) a few seconds later.

phantomjs error:

λ phantomjs --webdriver=5000
PhantomJS is launching GhostDriver...
[INFO  - 2015-04-07T06:53:53.792Z] GhostDriver - Main - running on port 5000
[INFO  - 2015-04-07T06:54:00.583Z] Session [dec7cd30-dcf2-11e4-b182-055bc0259fc0] - page.settings - {"XSSAuditi
ngEnabled":false,"javascriptCanCloseWindows":true,"javascriptCanOpenWindows":true,"javascriptEnabled":true,"loa
dImages":true,"localToRemoteUrlAccessEnabled":false,"userAgent":"Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKi
t/534.34 (KHTML, like Gecko) PhantomJS/1.9.8 Safari/534.34","webSecurityEnabled":true}
[INFO  - 2015-04-07T06:54:00.583Z] Session [dec7cd30-dcf2-11e4-b182-055bc0259fc0] - page.customHeaders:  - {}
[INFO  - 2015-04-07T06:54:00.584Z] Session [dec7cd30-dcf2-11e4-b182-055bc0259fc0] - Session.negotiatedCapabilit
ies - {"browserName":"phantomjs","version":"1.9.8","driverName":"ghostdriver","driverVersion":"1.1.0","platform
":"windows-8-32bit","javascriptEnabled":true,"takesScreenshot":true,"handlesAlerts":false,"databaseEnabled":fal
se,"locationContextEnabled":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"cssSelector
sEnabled":true,"webStorageEnabled":false,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{
"proxyType":"direct"}}
[INFO  - 2015-04-07T06:54:00.584Z] SessionManagerReqHand - _postNewSessionCommand - New Session Created: dec7cd
30-dcf2-11e4-b182-055bc0259fc0

gulp protractor error:

   Error: ECONNREFUSED connect ECONNREFUSED
   Stacktrace:
     Error: ECONNREFUSED connect ECONNREFUSED
    at ClientRequest.<anonymous> (C:\Users\Eigenaar\Documents\3de_Academiejaar\Stage\GitHub_Repos\proj_Jesper\n
ode_modules\protractor\node_modules\selenium-webdriver\http\index.js:145:16)
    at ClientRequest.emit (events.js:107:17)
    at Socket.socketErrorListener (_http_client.js:272:9)
    at Socket.emit (events.js:107:17)
    at net.js:451:14
    at process._tickCallback (node.js:355:11)
==== async task ====
Protractor.waitForAngular()
    at ....

my protractor.conf.js:

exports.config = {
    rootElement: 'html',
    seleniumAddress: 'http://127.0.0.1:5000',

    capabilities: {
        'browserName': 'phantomjs',
        'phantomjs.binary.path': require('phantomjs').path
    },

    specs: [paths.e2e + '/**/*.js'],

    jasmineNodeOpts: {
        showColors: true,
        defaultTimeoutInterval: 30000
    }
};

Solution

  • Problem solved. As I was working with gulp, I forgot to run a single command which screwed up the whole project... "gulp serve" was the key! Now he will run the e2e-test using phantomJS. Thanks everybody for the help! Really appreciate it.