自第二次将我的问题标记为对ChromeDriver ERR_SSL_PROTOCOL_ERROR despite --ignore-certificate-errors的重复查询以来,我第二次发布该问题-并非如此。
我的问题与Geckodriver(对于Firefox)明确相关,与ChromeDriver无关。我的问题是:我已通过nightwatch.json文件将Firefox设置为默认浏览器,但由于某些原因,我不断遇到以下错误:
'运行.navigateTo()协议操作时出错:无法验证此主机上运行的SSL证书。如果您希望强制接受不安全的SSL证书,请在期望的功能选项中设置acceptInsecureCerts = true'
正如错误中所建议的那样,我在nightwatch.json中使用了'desiredCapabilities'下的'acceptInsecureCerts = true'选项,但仍然无法正常工作。有任何建议吗?
这是我的nightwatch.json文件的样子:
{
"src_folders": [
"./src"
],
"globals_path": "./globalsModule.js",
"page_object_path": "./src/components",
"custom_commands_path": "./src/custom-commands",
"disable_colors": false,
"test_workers": false,
"webdriver": {
"start_process": true
},
"test_settings": {
"default": {
"webdriver": {
"server_path": "./node_modules/.bin/geckodriver",
"cli_args": [
"--log",
"debug"
]
},
"disable_colors": false,
"screenshots": {
"enabled": false,
"path": ""
},
"request_timeout_options": {
"timeout": 60000,
"retry_attempts": 5
},
"desiredCapabilities" : {
"browserName" : "firefox",
"acceptInsecureCerts" : true
}
},
"chrome": {
"webdriver": {
"port": 9515,
"default_path_prefix": "",
"server_path": "./node_modules/.bin/chromedriver",
"cli_args": [
"--verbose"
]
},
"desiredCapabilities": {
"browserName": "chrome",
"acceptSslCerts": true,
"loggingPrefs": {
"driver": "INFO",
"server": "OFF",
"browser": "INFO"
}
}
}
}
}
这是我的nightwatch.conf.js文件的样子:
const gecko = require("geckodriver");
module.exports = (function (settings) {
// console.log('Firefox Path:\r\n', gecko.path);
settings.test_settings.default.webdriver.server_path = gecko.path;
return settings;
})(require("./nightwatch.json"));
我什至尝试使用“功能”:{“ alwaysMatch”:{“ acceptInsecureCerts”:true}} ,而不是“ desiredCapabilities”:{“ acceptInsecureCerts”:true} 但没有运气。