FF 51 上的 Geckodriver 出现无效证书错误
Invalid certificate error with Geckodriver on FF 51
我在带有 Geckodriver 版本 v0.14.0 的 Firefox 51.0.1 上使用 Selenium 3。我在试图打开 URL 的浏览器上遇到错误,它说连接不安全(证书错误),尽管我检查了证书并且它是有效的。
错误是这样的:
Command failed: open target="" value="https://mydomain.mysite.com/default" -> Reached error page: about:certerror?e=nssBadCert&u=https%3A//mydomain.mysite.com/default&c=UTF-8&f=regular&d=mydomain.mysite.com%20uses%20an%20invalid%20security%20certificate.%0A%0AThe%20certificate%20is%20not%20trusted%20because%20the%20issuer%20certificate%20is%20unknown.%0AThe%20server%20might%20not%20be%20sending%20the%20appropriate%20intermediate%20certificates.%0AAn%20additional%20root%20certificate%20may%20need%20to%20be%20imported.%0A%0AError%20code%3A%20%3Ca%20id%3D%22errorCode%22%20title%3D%22SEC_ERROR_UNKNOWN_ISSUER%22%3ESEC_ERROR_UNKNOWN_ISSUER%3C/a%3E%0A
我正在使用以下代码(下面的部分代码段)来设置 FF 的功能,acceptSslCerts 似乎是 not 设置为 true.
System.setProperty("webdriver.gecko.driver", geckoDriverLocation);
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability(CapabilityType.ELEMENT_SCROLL_BEHAVIOR, 1);
FirefoxProfile profile = new FirefoxProfile();
// Set the download path in Firefox profile
profile.setPreference("browser.download.dir", "/User/me/download");
profile.setPreference("browser.download.folderList", 2);
profile.setPreference("browser.download.manager.showWhenStarting",false);
profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "images/jpeg, application/pdf, application/octet-stream, application/zip, application/xml");
profile.setPreference("pdfjs.disabled", true);
profile.setAcceptUntrustedCertificates(true);
profile.setAssumeUntrustedCertificateIssuer(true);
desiredCapabilities.setCapability(FirefoxDriver.PROFILE, profile);
desiredCapabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
desiredCapabilities.setCapability("acceptInsecureCerts", true);
return new FirefoxDriver(desiredCapabilities);
如果我在上面的最后一个语句上放置断点并检查,它 returns ((RemoteWebDriver) webDriver).getCapabilities().getCapability("acceptSslCerts")
为 false。即 acceptSslCerts not 设置为 true。详细的错误消息(此处未显示)显示了同样的事实。
这可能是发生错误的原因吗?可以做些什么来确保正确设置此值 (acceptSslCerts)?
请注意,使用 Firefoxdriver 的 FF 47 上的 Selenium 2 不会发生此错误。
任何帮助将不胜感激。
根据下面发布的更新,除非使用 Firefox v52,否则无法解决上述问题。
试用了仍处于测试阶段的 FF 52。成功了!
我在带有 Geckodriver 版本 v0.14.0 的 Firefox 51.0.1 上使用 Selenium 3。我在试图打开 URL 的浏览器上遇到错误,它说连接不安全(证书错误),尽管我检查了证书并且它是有效的。
错误是这样的:
Command failed: open target="" value="https://mydomain.mysite.com/default" -> Reached error page: about:certerror?e=nssBadCert&u=https%3A//mydomain.mysite.com/default&c=UTF-8&f=regular&d=mydomain.mysite.com%20uses%20an%20invalid%20security%20certificate.%0A%0AThe%20certificate%20is%20not%20trusted%20because%20the%20issuer%20certificate%20is%20unknown.%0AThe%20server%20might%20not%20be%20sending%20the%20appropriate%20intermediate%20certificates.%0AAn%20additional%20root%20certificate%20may%20need%20to%20be%20imported.%0A%0AError%20code%3A%20%3Ca%20id%3D%22errorCode%22%20title%3D%22SEC_ERROR_UNKNOWN_ISSUER%22%3ESEC_ERROR_UNKNOWN_ISSUER%3C/a%3E%0A
我正在使用以下代码(下面的部分代码段)来设置 FF 的功能,acceptSslCerts 似乎是 not 设置为 true.
System.setProperty("webdriver.gecko.driver", geckoDriverLocation);
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability(CapabilityType.ELEMENT_SCROLL_BEHAVIOR, 1);
FirefoxProfile profile = new FirefoxProfile();
// Set the download path in Firefox profile
profile.setPreference("browser.download.dir", "/User/me/download");
profile.setPreference("browser.download.folderList", 2);
profile.setPreference("browser.download.manager.showWhenStarting",false);
profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "images/jpeg, application/pdf, application/octet-stream, application/zip, application/xml");
profile.setPreference("pdfjs.disabled", true);
profile.setAcceptUntrustedCertificates(true);
profile.setAssumeUntrustedCertificateIssuer(true);
desiredCapabilities.setCapability(FirefoxDriver.PROFILE, profile);
desiredCapabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
desiredCapabilities.setCapability("acceptInsecureCerts", true);
return new FirefoxDriver(desiredCapabilities);
如果我在上面的最后一个语句上放置断点并检查,它 returns ((RemoteWebDriver) webDriver).getCapabilities().getCapability("acceptSslCerts")
为 false。即 acceptSslCerts not 设置为 true。详细的错误消息(此处未显示)显示了同样的事实。
这可能是发生错误的原因吗?可以做些什么来确保正确设置此值 (acceptSslCerts)?
请注意,使用 Firefoxdriver 的 FF 47 上的 Selenium 2 不会发生此错误。
任何帮助将不胜感激。
根据下面发布的更新,除非使用 Firefox v52,否则无法解决上述问题。
试用了仍处于测试阶段的 FF 52。成功了!