不安全连接-Firefox-Selenium C#

不安全连接-Firefox-Selenium C#,c#,selenium,firefox,C#,Selenium,Firefox,IDE:Visual Studio 2015 Geckodriver.exe(版本0.19.0)-发布日期:2017年9月25日 Firefox版本:56.0b8(64位) Selenium webdriver版本:3.6.0 我使用Selenium和C#完成了以下代码行: using (FirefoxDriver = new FirefoxDriver () driver) { driver.Navigate (). GoToUrl("https://www.teste.gov.br/segu

IDE:Visual Studio 2015 Geckodriver.exe(版本0.19.0)-发布日期:2017年9月25日 Firefox版本:56.0b8(64位) Selenium webdriver版本:3.6.0

我使用Selenium和C#完成了以下代码行:

using (FirefoxDriver = new FirefoxDriver () driver)
{
driver.Navigate (). GoToUrl("https://www.teste.gov.br/seguro/loginPortal.asp");
Thread.Sleep (1000 * 60);
}
该页面将打开一条消息“您的连接不是私有的”,错误为“您的连接不安全”。 要解决此问题,您已使用以下代码:

profile = webdriver.FirefoxProfile ()
profile.accept_untrusted_certs = True
driver = new FirefoxDriver (profile)

profile = webdriver.FirefoxProfile ()
profile.accept_untrusted_certs = True
driver = new FirefoxDriver (profile)

profile.setAcceptUntrustedCertificates (true);                         
profile.setAssumeUntrustedCertificateIssuer (false);
driver = new FirefoxDriver (profile)

ffProfile.setAcceptUntrustedCertificates (true)
ffProfile.setAssumeUntrustedCertificateIssuer (false)
driver = new FirefoxDriver (ffProfile)
和其他代码


但问题仍然存在。如何解决这个问题?

TL:DR;没有合理的方法来解决这个问题

如果绝对有必要只访问站点,例如创建cookie,请使用PhantomJS。我尝试过的每个浏览器驱动程序都会出错,如果没有某种安全漏洞,就不可能绕过它

浏览器确实让您知道该网站不安全。尽管它是一个政府网站,但它可能会受到威胁

另一方面,这样做可能更干净:

FirefoxDriver() ffDriver = new FirefoxDriver();
ffDriver.Navigate("myCoolSite.url");