这是我的硒设置:
"selenium": {
"start_process": true,
"start_session": true,
"server_path": "./nightwatch/drivers/selenium-server.jar",
"log_path": "./nightwatch/reports",
"host": "127.0.0.1",
"port": 4444,
"cli_args": {
"webdriver.chrome.driver": "nightwatch/drivers/chromedriver.exe",
"webdriver.gecko.driver": "nightwatch/drivers/geckodriver.exe",
"webdriver.ie.driver": "nightwatch/drivers/IEDriverServer.exe"
}
}
我的firefox设置:
"firefox": {
"selenium_port": 4444,
"default_path_prefix": "/wd/hub",
"globals": {
"environment": "firefox"
},
"desiredCapabilities": {
"browserName": "firefox",
"alwaysMatch": {
"moz:firefoxOptions": {
"args": ["-headless"]
}
}
}
}
被困了好几天搞清楚了。 Firefox正在成功打开并进行测试,但不是在无头模式下。
Versions I am using:
Firefox 60 (64 bit)
Selenium 3.4
Geckodriver 0.20 (64 bit)
答案 0 :(得分:1)
我使用以下配置进行工作-主要区别在于未设置alwaysMatch
和args双破折号:--headless
。
还请注意,在将env
指定为vue-cli-service
时,它期望一个空格,而不是环境名称前的=
,即:
vue-cli-service test:e2e --env FirefoxHeadless
"FirefoxHeadless": {
"desiredCapabilities": {
"browserName": "firefox",
"acceptInsecureCerts": true,
"moz:firefoxOptions": {
"args": ["--headless"]
}
}
}
答案 1 :(得分:1)
我的true
和geckodriver/Capabilities.html#capabilities-example一样,仅使用单横线false
带有firefox 65的geckodriver版本0.24.0(2019-01-28)
nightwatch.json