无法在 Java 中使用 geckodriver 克服 Firefox 47.0.2 中的 SSL 证书

Cannot overcome SSL certificates in Firefox 47.0.2 using geckodriver in Java

我正在尝试使用 geckodriver 和 selenium-standalone-server-3.0.1 jar 克服 SSL 证书以访问 Firefox 47.0.2、48 上的网页。我正在使用的代码正在打开浏览器但不接受证书。

 System.setProperty("webdriver.gecko.driver",
                               System.getProperty("user.dir") + aProperties.getProperties().getProperty(aProperties.getOsName() + ".geckoDriverPath"));
            DesiredCapabilities cap = DesiredCapabilities.firefox();
            FirefoxProfile profile = new FirefoxProfile();
            profile.setAcceptUntrustedCertificates(true);
            profile.setAssumeUntrustedCertificateIssuer(false);
            cap.setCapability(FirefoxDriver.PROFILE, profile);
            cap.setCapability("acceptSslCerts", true);
            cap.setCapability("applicationCacheEnabled", true);
            cap.setCapability("marionette", false);
            driver = new MarionetteDriver(cap);

我找到了一种在需要时设置配置文件和功能的方法。但我一直坚持接受 SSL 证书。

Here is the original bug. This was an issue on both Firefox's side and GeckoDriver. Not sure what version of GeckoDriver you are using, but the latest (0.15.0) 应该修复。另请注意,Firefox 错误未在版本 47 中修复或 48 必须获得 Firefox 52.0,这是截至(3/7/2017)

的稳定版本