我设置了我的配置,添加到环境中:
“测试设置”:{
“默认”: {
“硒端口”:4444,
“selenium_host”:“本地主机”,
"default_path_prefix": "/wd/hub",
“沉默”:是的,
“截图”:{
“启用”:是的,
“on_failure”:是的,
“on_error”:是的,
“路径”:“tmp_screenshots”
}
},
"firefox": {
"desiredCapabilities": {
"browserName": "firefox",
"marionette": true,
"acceptSslCerts": true,
"javascriptEnabled": true
},
"globals": {
"type": "firefox",
"user": "me1",
"pass": "test"
}
},
"chrome": {
"desiredCapabilities": {
"browserName": "chrome",
"chromeOptions": {
"args": [
"disable-web-security",
"use-fake-device-for-media-stream",
"use-fake-ui-for-media-stream"
]
},
"acceptSslCerts": true,
"javascriptEnabled": true
},
"globals": {
"type": "chrome",
"user": "me1",
"pass": "test"
}
},
当我运行下面的执行行时
npm run nightwatch -t 测试/google.js -e firefox,chrome
我的测试从两个不同的浏览器开始。