这是我的nightwatch.json的样子
{
"src_folders" : ["tests"],
"output_folder" : "reports",
"custom_commands_path" : "",
"custom_assertions_path" : "",
"page_objects_path" : "",
"globals_path" : "./globals.js",
"selenium" : {
"start_process" : false
},
"test_settings" : {
"default" : {
"launch_url" : "http://localhost",
"selenium_port" : 9515,
"selenium_host" : "localhost",
"silent": false,
"default_path_prefix": "",
"desiredCapabilities": {
"browserName": "firefox",
"javascriptEnabled": true,
"acceptSslCerts": true,
"marionette": true
}
}
}
}
这是我的globals.js的样子:
var geckodriver = require('geckodriver');
module.exports = {
before : function(done) {
geckodriver.start();
done();
},
after : function(done) {
geckodriver.stop();
done();
}
};
当我在这里运行夜班时,会发生什么:
▶ nightwatch
[New] Test Suite
========================
Running: login
INFO Request: POST /session
- data: {"desiredCapabilities":{"browserName":"firefox","javascriptEnabled":true,"acceptSslCerts":true,"platform":"ANY","marionette":true,"name":"New"}}
- headers: {"Content-Type":"application/json; charset=utf-8","Content-Length":148}
Error retrieving a new session from the selenium server
Connection refused! Is selenium server started?
{ Error: connect ECONNREFUSED 127.0.0.1:9515
at Object.exports._errnoException (util.js:1022:11)
at exports._exceptionWithHostPort (util.js:1045:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1090:14)
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 9515 }
我试图模仿独立Chrome设置的样子,但我想我错过了一些东西,或者那里有一个阻止事情继续进行的错误。
答案 0 :(得分:0)
我没有正确的端口设置,woops!我需要将selenium_port
更改为4444