我正在尝试将nightwatch与独立的selenium一起使用(不需要通过nightwatch手动启动selenium )。我想在不打开浏览器的情况下运行它。这是我的配置
output_folder: 'test/reports',
custom_assertions_path: '',
page_objects_path: "test/page-objects",
selenium: {
start_process: false,
},
test_settings: {
default: {
launch_url : 'http://localhost/dist',
selenium_port: 4446,
selenium_host: "xxx.xxx.xx.xx",
desiredCapabilities: {
browserName: 'chrome',
chromeOptions : {
args : ["--no-sandbox"]
},
},
}
},但这不是定位元素,测试失败。但是,如果我更改配置以启动selenium服务器并使用chrome运行,如下面的配置所示,它将完美地工作。
selenium: {
start_process: true,
server_path: seleniumServerPath,
cli_args: {
'webdriver.chrome.driver': chromedriverPath,
},
},
test_settings: {
default: {
launch_url : 'http://localhost/dist',
desiredCapabilities: {
browserName: 'chrome',
},
}
},我遗漏了什么?我希望它在gitlab runner中运行。
发布于 2018-12-04 12:32:48
找到了解决方案。它使用以下配置工作
"selenium": {
"start_process": false,
"server_path": seleniumServerPath,
"cli_args": {
'webdriver.chrome.driver': chromedriverPath,
},
},
"test_settings" : {
"default" : {
"launch_url" : 'http://xxx.xxx.xxx.xx:8000',
"selenium_port" : 4446,
"selenium_host" : "xxx.xxx.xxx.xx",
"silent": true,
"screenshots" : {
"enabled" : true,
"on_failure" : true,
"on_error" : false,
"path" : "tmp/screenshots"
},
"desiredCapabilities": {
"browserName": "chrome",
"chromeOptions" : {
"args" : ["--no-sandbox"]
},
"acceptSslCerts": true
}
},
},https://stackoverflow.com/questions/53594841
复制相似问题