你好(第一次在这里发帖),
我无法让 geckodriver 绕过证书错误。我做了很多研究并确保我拥有所有组件的最新版本。我强调这一点的原因是因为该站点上存在的许多过去的问题都讨论过时的方法,例如使用 DesiredCapabilities。
这是我的代码:
FirefoxDriverService service = FirefoxDriverService.CreateDefaultService();
FirefoxProfile profile = new FirefoxProfile("QA"){
AcceptUntrustedCertificates = true
};
FirefoxOptions options = new FirefoxOptions(){
Profile = profile
};
var driver = new FirefoxDriver(options);
driver.Navigate().GoToUrl("https://google.ca");
上面的代码失败了,我在 Firefox 上仍然收到证书错误。我在调试时注意到的一件事是驱动程序仍然将“acceptInsecureCerts”功能视为“假”。屏幕截图如下。
我做错了什么吗?请指教。
我目前正在使用:
- Selenium V3.9(最新)
- Mozilla Firefox Nightly 60.0a(最新)
- geckodriver 19.1(最新)
最佳答案
啊!找到它:Firefox Options 有一个修复它的“addcapabilities”功能。
options.AddAdditionalCapability("acceptInsecureCerts", true, true);
关于C# - Selenium - firefox 驱动程序无法捕获和应用 AcceptInsecureCerts(2018/02/08 最新版本),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48691513/