2017-02-28 14 views
1

我試圖用geckodriver和selenium-standalone-server-3.0.1 jar來克服訪問Firefox 47.0.2,48上網頁的SSL證書。我正在使用的代碼是打開瀏覽器,但不接受證書。在Java中使用geckodriver無法克服Firefox 47.0.2中的SSL證書

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證書。

回答

0

Here是最初的錯誤。這是Firefox和GeckoDriver的問題。不知道你使用的是哪個版本的GeckoDriver,但是最新的(0.15.0)應該被修復。另外請注意,火狐的bug在47或48版本中沒有得到解決得到火狐52.0這是穩定版本截止(3/7/2017)

+0

嗨,我使用的是GeckoDriver v0.14.0。 –

+0

對不起延遲確認。升級工作! –