Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
574 views
in Technique[技术] by (71.8m points)

angularjs - Unable to run Protractor - ECONNREFUSED connect ECONNREFUSED

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.binprotractor protractorconfig.js

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

C:SrcMyProject
ode_modulesprotractor
ode_modulesselenium-webdriverlibwebdriverpromise.js:1542
      throw error;
            ^
Error: ECONNREFUSED connect ECONNREFUSED
    at ClientRequest.<anonymous> (C:SrcMyProject
ode_modulesprotractor
ode_modulesselenium-webdriverhttpindex.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:SrcMyProject
ode_modulesprotractor
ode_modulesselenium-webdriv
erlibwebdriverwebdriver.js:130:49)
    at Function.webdriver.WebDriver.createSession (C:SrcMyProject
ode_modulesprotractor
ode_modulesselenium-webdriver
libwebdriverwebdriver.js:110:30)
    at Builder.build (C:SrcMyProject
ode_modulesprotractor
ode_modulesselenium-webdriveruilder.js:105:20)
    at runJasmineTests (C:SrcMyProject
ode_modulesprotractorlib
unner.js:191:45)
    at C:SrcMyProject
ode_modulesprotractorlib
unner.js:255:5
    at C:SrcMyProject
ode_modulesprotractor
ode_modulesselenium-webdriverlibgoogase.js:1178:15
    at webdriver.promise.ControlFlow.runInNewFrame_ (C:SrcMyProject
ode_modulesprotractor
ode_modulesselenium-webdriv
erlibwebdriverpromise.js:1438:20)
    at notify (C:SrcMyProject
ode_modulesprotractor
ode_modulesselenium-webdriverlibwebdriverpromise.js:328:12)
    at then (C:SrcMyProject
ode_modulesprotractor
ode_modulesselenium-webdriverlibwebdriverpromise.js:377:7)

What am I doing wrong?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I solved this with --standalone flag:

webdriver-manager start --standalone


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...