你可以發佈你的整個配置文件?
desiredCapabilities錯誤,請按照此配置設置合適的nightwatch.conf.js,您需要將chromedriver
位置更改爲您的位置。
const SCREENSHOT_PATH = "./screenshots/";
const BINPATH = './node_modules/nightwatch/bin/';
// we use a nightwatch.conf.js file so we can include comments and helper functions
module.exports = {
"src_folders": [
"scripts/test"// Where you are storing your Nightwatch e2e tests
],
"output_folder": "./reports", // reports (test outcome) output by nightwatch
"selenium": { // downloaded by selenium-download module (see readme)
"start_process": true, // tells nightwatch to start/stop the selenium process
"server_path": "./node_modules/nightwatch/bin/selenium.jar", // the standard alone selenium server jar
"host": "127.0.0.1",
"port": 4444, // standard selenium port
"cli_args": { // chromedriver is downloaded by selenium-download (see readme)
"webdriver.chrome.driver" : "chromedriver.exe", //chromedriver location
}
},
"test_settings": {
"default": {
"screenshots": {
"enabled": true, // if you want to keep screenshots
"path": SCREENSHOT_PATH // save screenshots here
},
"globals": {
"waitForConditionTimeout": 5000 // sometimes internet is slow so wait.
},
"desiredCapabilities": { // use Chrome as the default browser for tests
"browserName": "chrome",
},
},
"chrome": {
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true, // turn off to test progressive enhancement
"chromeOptions" :{
"args":[]
},
"selenium": {
"cli_args": {
"webdriver.chrome.driver" : "chromedriver.exe",
},
},
},
}
}
}
更多的例子:https://github.com/dwyl/learn-nightwatch
desiredCapabilities是正確的,因爲我沒有自己的Chrome斑點覆蓋。我認爲這是需要添加到配置日誌級別 –
的問題檢查這一點,看看它是否有幫助https://github.com/webdriverio/webdriverio/issues/476 – Raymond