Unable to run Protractor - ECONNREFUSED connect ECONNREFUSED

SL Dev picture SL Dev · Nov 18, 2013 · Viewed 58k times · Source

I'm trying to learn AngularJS. As part of this, I want to learn to use end-to-end testing. Currently, I have a directory structure like this:

node_modules
  .bin
  ...
  protractor
    ...
    node_modules
       .bin
       adam-zip
       glob
       minijasminenode
       optimist
       saucelabs
       selenium-webdriver
protractor
  config.js
src
  tests
    test.e2e.js

My config.js file looks like the following:

exports.config = {
    seleniumAddress: 'http://localhost:4444/wd/hub',

    capabilities: {
        'browserName': 'chrome'
    },

    specs: [
        '../src/tests/test.e2e.js'
    ],

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

test.e2e.js looks like the following:

'use strict';

describe('My Sample', function () {
    driver = protractor.getInstance();

    beforeEach(function () {
        driver.get('#/');
    });

    it('My First Test', function () {
        message = "Hello.";
        expect(message).toEqual('World.');
    });
});

When I attempt to run my end-to-end tests using protractor, I run the following command from the command-line:

node_modules\.bin\protractor protractor\config.js

When I run that command, I receive the following error:

C:\Src\MyProject\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1542
      throw error;
            ^
Error: ECONNREFUSED connect ECONNREFUSED
    at ClientRequest.<anonymous> (C:\Src\MyProject\node_modules\protractor\node_modules\selenium-webdriver\http\index.js:12
7:16)
    at ClientRequest.EventEmitter.emit (events.js:95:17)
    at Socket.socketErrorListener (http.js:1528:9)
    at Socket.EventEmitter.emit (events.js:95:17)
    at net.js:441:14
    at process._tickCallback (node.js:415:13)
==== async task ====
WebDriver.createSession()
    at Function.webdriver.WebDriver.acquireSession_ (C:\Src\MyProject\node_modules\protractor\node_modules\selenium-webdriv
er\lib\webdriver\webdriver.js:130:49)
    at Function.webdriver.WebDriver.createSession (C:\Src\MyProject\node_modules\protractor\node_modules\selenium-webdriver
\lib\webdriver\webdriver.js:110:30)
    at Builder.build (C:\Src\MyProject\node_modules\protractor\node_modules\selenium-webdriver\builder.js:105:20)
    at runJasmineTests (C:\Src\MyProject\node_modules\protractor\lib\runner.js:191:45)
    at C:\Src\MyProject\node_modules\protractor\lib\runner.js:255:5
    at C:\Src\MyProject\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\base.js:1178:15
    at webdriver.promise.ControlFlow.runInNewFrame_ (C:\Src\MyProject\node_modules\protractor\node_modules\selenium-webdriv
er\lib\webdriver\promise.js:1438:20)
    at notify (C:\Src\MyProject\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:328:12)
    at then (C:\Src\MyProject\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:377:7)

What am I doing wrong?

Answer

juanignaciosl picture juanignaciosl · Jan 14, 2014

I solved this with --standalone flag:

webdriver-manager start --standalone