C# - Selenium - firefox 驱动程序无法捕获和应用 AcceptInsecureCerts(2018/02/08 最新版本)

C# - Selenium - firefox driver fails to capture and apply AcceptInsecureCerts (2018/02/08 Latest Releases)

您好(第一次在这里发帖),

我无法让 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" 功能视为 "false"。截图如下。

我是不是做错了什么?请指教

我目前正在使用:

啊!找到它:Firefox Options 有一个 "addcapabilities" 功能可以修复它。

options.AddAdditionalCapability("acceptInsecureCerts", true, true);