我正在运行节点夜巡.js与Chrome驱动程序和Selenium一起
Config in nightwatch.json 似乎不起作用
"test_settings": {
"default": {
"desiredCapabilities": {
"loggingPrefs": {
"browser": "ALL",
"driver": "ALL",
"performance": "ALL",
"server": "OFF"
}
}
}
你能发布你的整个配置文件吗?
所需的功能是错误的,按照此配置设置适当的 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
终于让它工作了
"silent": true
就是这么简单