protractor icon indicating copy to clipboard operation
protractor copied to clipboard

ECONNREFUSED after server shutdown with grunt-protractor-runner

Open DavidTanner opened this issue 12 years ago • 17 comments

Using version 1.0.0 I get an error message that the connection was refused. This is similiar to issue #85. I found someone had similiar issues in http://stackoverflow.com/questions/21382962/when-running-protractor-with-phantomjs-browser-only-able-to-run-tests-once and changed my version to 0.24.2 and the issue went away.

Session deleted: Going to shut down the Selenium server Shutting down Selenium server: http://127.0.0.1:4444 Shut down Selenium server: http://127.0.0.1:4444 (OKOK)

node_modules/protractor/node_modules/selenium-webdriver/http/index.js:136 callback(new Error(message)); ^ Error: ECONNREFUSED connect ECONNREFUSED at ClientRequest. (node_modules/protractor/node_modules/selenium-webdriver/http/index.js:136:16) at ClientRequest.EventEmitter.emit (events.js:95:17) at Socket.socketErrorListener (http.js:1547:9) at Socket.EventEmitter.emit (events.js:95:17) at net.js:440:14 at process._tickCallback (node.js:415:13) ==== async task ==== WebDriver.quit()

DavidTanner avatar Jul 29 '14 16:07 DavidTanner

Clarification - does this only occur using Phantom.js?

juliemr avatar Jul 29 '14 18:07 juliemr

@DavidTanner I just updated to v1.0.0, and it started happening exactly the same behavior, and only with phantomJS. @juliemr yes, only with phantomJS, other browsers seems to be working normal :(

JesusLopezCh avatar Jul 29 '14 20:07 JesusLopezCh

@juliemr Yes, just phantomjs and for me only in ubuntu. On Jul 29, 2014 2:54 PM, "JesusLopezCh" [email protected] wrote:

@DavidTanner https://github.com/DavidTanner I just updated to v1.0.0, and star happening exactly the same behavior, and only with phantomJS. @juliemr https://github.com/juliemr yes, only with phantomJS, other browsers seems to be working normal :(

Reply to this email directly or view it on GitHub https://github.com/angular/protractor/issues/1123#issuecomment-50537031.

DavidTanner avatar Jul 29 '14 21:07 DavidTanner

Facing the same issue with Chrome. It works OK on version 0.24.2. I am running this with grunt task using https://www.npmjs.org/package/grunt-protractor-runner.

georgievrado avatar Jul 30 '14 15:07 georgievrado

How can I downgrade my version, updating the 'package.json' file ?

JesusLopezCh avatar Jul 30 '14 16:07 JesusLopezCh

Just change the version to ~0.24.2 or ^0.24.2 depending on your node version, then npm install to get the version you want.

DavidTanner avatar Jul 30 '14 17:07 DavidTanner

+1 here with Chrome on both OS X and Ubuntu.

"Needs: more info" - please tell us what more information you need.

kdekooter avatar Sep 11 '14 08:09 kdekooter

+1 with Chrome on Windows 7.

grunt-protractor-runner: ^1.14 grunt-protractor-webdriver: ^0.1.9 protractor: ^1.2.0

franktroia avatar Sep 26 '14 15:09 franktroia

+1 with Chrome on Mac OS Lion grunt-protractor-runner: ^1.14

==============(fixed) I got no error after running webdriver-manager start at first

hueitan avatar Nov 02 '14 12:11 hueitan

+1 with Chrome on Mac OS Yosemite grunt-protractor-runner: ^1.1.4 grunt-protractor-webdriver: ^0.1.9 protractor: ^1.4.0

console report https://gist.github.com/orloffv/f255d93c9b577b0f784c

orloffv avatar Dec 01 '14 12:12 orloffv

OK - I think there might be multiple issues at work here. Let's ignore the phantom issues - people who aren't using phantom, can you share your configuration? I cannot reproduce this.

juliemr avatar Dec 09 '14 00:12 juliemr

i'm running Windows 8.1 x64.

Gruntfile.js =


module.exports = function (grunt) {

    // Project configuration.
    grunt.initConfig({
        protractor_webdriver: {
            e2eUpdate: {
                options: {
                    path: './node_modules/.bin/',
                    command: 'webdriver-manager update --standalone'
                },  
            },  
            e2eStart: {
                options: {
                    path: './node_modules/.bin/',
                    command: 'webdriver-manager start'
                },  
            },              
        },
        protractor: {
            options: {
                configFile: "ProtractorConfig.js",
                keepAlive: true, // If false, the grunt process stops when the test fails.
                noColor: false, // If true, protractor will not use colors in its output.
                args: {

                    // Arguments passed to the command
                }
            },
            e2e: {
                // Grunt requires at least one target to run so you can simply put 'all: {}' here too.
                options: {
                    configFile: "ProtractorConfig.js", // Target-specific config file
                    args: {} // Target-specific arguments
                }
            },
        },
    });
    grunt.loadNpmTasks('grunt-protractor-webdriver');
    grunt.loadNpmTasks('grunt-protractor-runner');

    // Default task(s).
    grunt.registerTask('default', ['protractor_webdriver:e2eStart', 'protractor:e2e']);
};

package.json =


{
    "name": "UI.NodeE2ETests",
    "version": "1.0.0",
    "description": "UI.NodeE2ETests",
    "private": false,
    "author": "fifteenbelow",
    "devDependencies": {
        "grunt-protractor-runner": "~1.1.4",
        "grunt-protractor-webdriver": "~0.1.9",         
        "jasmine-reporters": "<2.0.0"       
    },
    "scripts": {
    "postinstall": "node_modules/.bin/webdriver-manager update --standalone"
  }
}

protractorConfig.js =


exports.config = {
    seleniumAddress: 'http://localhost:4444/wd/hub',
    specs: ['../src/UI.NodeE2ETests/tests/**/*spec.js'],
    multiCapabilities: [,{
            browserName: 'chrome'
        }],
    jasmineNodeOpts: {
    onComplete: null,
    defaultTimeoutInterval: 180000,
    isVerbose: true,
    showColors: true,
    includeStackTrace: true
    },
    allScriptsTimeout: 180000,
    framework: 'jasmine',
    onPrepare: function() {
        if (process.env.TEAMCITY_VERSION)
        {
            require('jasmine-reporters');
            jasmine.getEnv().addReporter(new jasmine.TeamcityReporter());
        }
    }
}

Output from tests =


Running "protractor_webdriver:e2eStart" (protractor_webdriver) task
Starting Selenium server
Started Selenium server: http://127.0.0.1:4444

Running "protractor:e2e" (protractor) task
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
Session created: count=1, browserName=chrome
Elements feature
  should be able to delete and add a element - pass

Send notification feature
  should be able to create and send a manual notification - pass
Signin invalid feature
  should not sign in with invalid credentials - pass
Signin feature
  should sign in using valid credentials - pass
Templates and Subjects feature
  should be able to delete and add a template and delete and add a subject - pas
s
Tenants feature
  should display tenants - pass
  should be able to select tenant - pass
  should be able to switch tenant - pass


Finished in 198.995 seconds
8 tests, 43 assertions, 0 failures

Session deleted: Going to shut down the Selenium server
Shutting down Selenium server: http://127.0.0.1:4444
Shut down Selenium server: http://127.0.0.1:4444 (OKOK)

D:\Git\XXX.AcceptanceTests\build\node_modules\grunt-protractor-runner\node_
modules\protractor\node_modules\selenium-webdriver\http\index.js:145
      callback(new Error(message));
               ^
Error: ECONNREFUSED connect ECONNREFUSED
    at ClientRequest.<anonymous> (D:\Git\XXX.AcceptanceTests\build\node_mod
ules\grunt-protractor-runner\node_modules\protractor\node_modules\selenium-webdr
iver\http\index.js:145:16)
    at ClientRequest.emit (events.js:95:17)
    at Socket.socketErrorListener (http.js:1551:9)
    at Socket.emit (events.js:95:17)
    at net.js:440:14
    at process._tickCallback (node.js:419:13)
==== async task ====
WebDriver.quit()
    at [object Object].webdriver.WebDriver.schedule (D:\Git\XXX.AcceptanceT
ests\build\node_modules\grunt-protractor-runner\node_modules\protractor\node_mod
ules\selenium-webdriver\lib\webdriver\webdriver.js:345:15)
    at [object Object].webdriver.WebDriver.quit (D:\Git\XXX.AcceptanceTests
\build\node_modules\grunt-protractor-runner\node_modules\protractor\node_modules
\selenium-webdriver\lib\webdriver\webdriver.js:418:21)
    at D:\Git\XXX.AcceptanceTests\build\node_modules\grunt-protractor-runne
r\node_modules\protractor\lib\driverProviders\driverProvider.js:28:16
    at D:\Git\XXX.AcceptanceTests\build\node_modules\grunt-protractor-runne
r\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\base.js:1582:
15
    at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (D:\Git\XXX.AcceptanceTests\build\node_modules\grunt-protractor-runner\node_modules\pro
tractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1654:20)
    at notify (D:\Git\XXX.AcceptanceTests\build\node_modules\grunt-protract
or-runner\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\
promise.js:465:12)
    at [object Object].then (D:\Git\XXX.AcceptanceTests\build\node_modules\
grunt-protractor-runner\node_modules\protractor\node_modules\selenium-webdriver\
lib\webdriver\promise.js:522:7)
    at D:\Git\XXX.AcceptanceTests\build\node_modules\grunt-protractor-runne
r\node_modules\protractor\lib\driverProviders\driverProvider.js:26:25
    at Array.map (native)
[launcher] Process exited with error code 1
>>
>> Test failed but keep the grunt process alive.

Note we are running grunt from F# Fake, but this should have no bearing on this error.

If i change my protractorConfig to use


multiCapabilities: [,{
            browserName: 'firefox'
        }],

then i do not get the error.

Mike-Hardy avatar Dec 16 '14 16:12 Mike-Hardy

I'm beginning to suspect this is an issue with grunt-protractor-runner, since everyone having the problem is using it. Anyone NOT using grunt-protractor-runner have this problem?

juliemr avatar Dec 16 '14 18:12 juliemr

Pretty sure you are right @juliemr. Have raised https://github.com/teerapap/grunt-protractor-runner/issues/99

Mike-Hardy avatar Dec 17 '14 09:12 Mike-Hardy

please reference https://github.com/teerapap/grunt-protractor-runner/issues/99 and https://github.com/teerapap/grunt-protractor-runner/issues/100 I managed to resolve this

Mike-Hardy avatar Jan 08 '15 16:01 Mike-Hardy

If any one has got the solution to this problem, please provide the details. I am facing same issue on mac osx.

Running "protractor:webdriver" (protractor) task Using the selenium server at http://localhost/wd/hub [launcher] Running 1 instances of WebDriver ERROR - Unable to start a WebDriver session.

/Users/sjoshi/Documents/SJWorkspace/GDAClientAutomationTest/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:145 callback(new Error(message)); ^ Error: ECONNREFUSED connect ECONNREFUSED at ClientRequest. (/Users/sjoshi/Documents/SJWorkspace/GDAClientAutomationTest/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:145:16) at ClientRequest.emit (events.js:95:17) at Socket.socketErrorListener (http.js:1552:9) at Socket.emit (events.js:95:17) at net.js:441:14 at process.tickCallback (node.js:442:13) ==== async task ==== WebDriver.createSession() at Function.webdriver.WebDriver.acquireSession (/Users/sjoshi/Documents/SJWorkspace/GDAClientAutomationTest/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:149:22) at Function.webdriver.WebDriver.createSession (/Users/sjoshi/Documents/SJWorkspace/GDAClientAutomationTest/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:123:30) at Builder.build (/Users/sjoshi/Documents/SJWorkspace/GDAClientAutomationTest/node_modules/protractor/node_modules/selenium-webdriver/builder.js:294:22) at DriverProvider.getNewDriver (/Users/sjoshi/Documents/SJWorkspace/GDAClientAutomationTest/node_modules/protractor/lib/driverProviders/driverProvider.js:38:7) at Runner.createBrowser (/Users/sjoshi/Documents/SJWorkspace/GDAClientAutomationTest/node_modules/protractor/lib/runner.js:180:37) at /Users/sjoshi/Documents/SJWorkspace/GDAClientAutomationTest/node_modules/protractor/lib/runner.js:257:21 at _fulfilled (/Users/sjoshi/Documents/SJWorkspace/GDAClientAutomationTest/node_modules/protractor/node_modules/q/q.js:797:54) at self.promiseDispatch.done (/Users/sjoshi/Documents/SJWorkspace/GDAClientAutomationTest/node_modules/protractor/node_modules/q/q.js:826:30) at Promise.promise.promiseDispatch (/Users/sjoshi/Documents/SJWorkspace/GDAClientAutomationTest/node_modules/protractor/node_modules/q/q.js:759:13) [launcher] Process exited with error code 1

Also if there are any specific versions that are compatible and works for you, please specify them.

skjoshi avatar Mar 17 '15 23:03 skjoshi

Looks like this is resolved. Closing.

juliemr avatar Mar 17 '15 23:03 juliemr