我可以使用以下命令在 Firefox 上运行测试:
nightwatch -t tests/test4.js
我的 nightwatchjs.json 配置文件:
{
"src_folders" : ["tests"],
"output_folder" : "reports",
"custom_commands_path" : "",
"custom_assertions_path" : "",
"globals_path" : "",
"selenium" : {
"start_process" : true,
"server_path" : "selenium-server-standalone-2.44.0.jar",
"log_path" : "",
"host" : "127.0.0.1",
"port" : 4444,
"cli_args" : {
"webdriver.chrome.driver" : "drivers/chromedriver"
}
},
"test_settings" : {
"default" : {
"launch_url" : "http://localhost",
"selenium_port" : 4444,
"selenium_host" : "localhost",
"silent": true,
"screenshots" : {
"enabled" : false,
"path" : ""
},
"desiredCapabilities": {
"browserName": "firefox",
"javascriptEnabled": true,
"acceptSslCerts": true
}
},
"chrome" : {
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true
}
}
}
}
但是我无法使用 Chrome 运行测试。这是命令:
nightwatch -t tests/test4.js -e chrome --verbose
和输出:
INFO Request: POST /wd/hub/session
- data: {"desiredCapabilities":{"browserName":"chrome","javascriptEnabled":true,"acceptSslCerts":true,"platform":"ANY","name":"Test4"}}
- headers: {"Content-Type":"application/json; charset=utf-8","Content-Length":127}
ERROR Response 500 POST /wd/hub/session{ sessionId: null,
status: 13,
state: 'unhandled error',
value:
{ message: null,
localizedMessage: null,
cause: null,
class: 'java.util.concurrent.TimeoutException',
hCode: 1023736867,
screen: null },
class: 'org.openqa.selenium.remote.Response',
hCode: 31447144 }
由于某些原因,相同的主要配置选项适用于 Firefox,但不适用于 Chrome。有人有同样的问题吗?
谢谢,
保罗