【问题标题】:C# - Selenium - firefox driver fails to capture and apply AcceptInsecureCerts (2018/02/08 Latest Releases)C# - Selenium - firefox 驱动程序无法捕获和应用 AcceptInsecureCerts (2018/02/08 最新版本)
【发布时间】:2018-07-19 09:05:24
【问题描述】:

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

我无法让 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(最新)

【问题讨论】:

标签: c# selenium firefox geckodriver


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 2018-12-31
    • 2019-12-30
    • 1970-01-01
    • 2017-09-09
    • 2018-09-20
    • 2017-04-19
    • 2016-08-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多