gpt4 book ai didi

angularjs - 无法运行 Protractor - ECONNREFUSED 连接 ECONNREFUSED

转载 作者:行者123 更新时间:2023-12-03 07:52:24 24 4
gpt4 key购买 nike

我正在尝试学习 AngularJS。作为其中的一部分,我想学习使用端到端测试。目前,我有一个这样的目录结构:

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

我的 config.js 文件如下所示:
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 如下所示:
'use strict';

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

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

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

当我尝试使用 Protractor 运行端到端测试时,我从命令行运行以下命令:
node_modules\.bin\protractor protractor\config.js

当我运行该命令时,我收到以下错误:
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)

我究竟做错了什么?

最佳答案

我用 --standalone 标志解决了这个问题:
webdriver-manager start --standalone

关于angularjs - 无法运行 Protractor - ECONNREFUSED 连接 ECONNREFUSED,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20055593/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com