问题描述
我正在尝试首次设置最新的nightwatch.js.这是我的nightwatch.json:
I am trying to setup the latest nightwatch.js for the first time. This is my nightwatch.json:
{
"src_folders" : ["tests"],
"output_folder" : "reports",
"custom_commands_path" : "",
"custom_assertions_path" : "",
"page_objects_path" : "",
"globals_path" : "",
"selenium" : {
"start_process" : true,
"server_path" : "selenium-server-standalone-3.8.1.jar",
"log_path" : "",
"port" : 4444,
"cli_args" : {
"webdriver.chrome.driver" : "",
"webdriver.gecko.driver" : "",
"webdriver.edge.driver" : ""
}
},
"test_settings" : {
"default" : {
"launch_url" : "http://localhost",
"selenium_port" : 4444,
"selenium_host" : "localhost",
"silent": true,
"screenshots" : {
"enabled" : false,
"path" : ""
},
"desiredCapabilities": {
"browserName": "firefox",
"marionette": true
}
},
"chrome" : {
"desiredCapabilities": {
"browserName": "chrome"
}
},
"edge" : {
"desiredCapabilities": {
"browserName": "MicrosoftEdge"
}
}
}
}
当我运行夜表时,出现此错误:
When I run nightwatch I get this error:
Starting selenium server... started - PID: 3176
[Go] Test Suite
===================
Running: Demo test
Error retrieving a new session from the selenium server
Connection refused! Is selenium server started?
{ value:
{ message: 'Unable to create new service: GeckoDriverService\nBuild info: ve
sion: \'3.8.1\', revision: \'6e95a6684b\', time: \'2017-12-01T19:05:32.194Z\'\n
ystem info: host: \'S0026COW1983\', ip: \'10.39.13.81\', os.name: \'Windows Ser
er 2008 R2\', os.arch: \'x86\', os.version: \'6.1\', java.version: \'1.8.0_131\
\nDriver info: driver.version: unknown',
error: 'session not created' },
我该如何解决?
推荐答案
我假设您正在启动default
测试设置,该设置将尝试访问geckoDriver.
I will assume that you are launching the default
test settings which will try to access geckoDriver.
您似乎尚未指定驱动程序"webdriver.chrome.driver" : ""
,"webdriver.gecko.driver" : ""
,"webdriver.edge.driver" : ""
Looks like you haven't specified the paths for your drivers, "webdriver.chrome.driver" : ""
, "webdriver.gecko.driver" : ""
, "webdriver.edge.driver" : ""
您需要将其指向驱动程序可执行文件,例如从我的项目中:'webdriver.gecko.driver':'/.selenium/geckodriver/0.19.0-x64-geckodriver'
You need to point those to your driver executables, e.g. from my project:'webdriver.gecko.driver':'/.selenium/geckodriver/0.19.0-x64-geckodriver'
这篇关于Nightwatch.js:为什么我无法创建新服务:GeckoDriverService?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!