2012-07-15 2 views
1

테스트를 위해 Selenium을 사용하여 페이지를로드하려고 시도하지만이 javax.net.ssl.SSLPeerUnverifiedException : 피어가 인증되지 않은 오류가 계속 발생합니다. 이제는 그것을 허용하는 여러 가지 방법을 시도했지만 간단하게 작동하지 않습니다!javax.net.ssl.SSLPeerUnverifiedException : Selenium 및 HtmlUnit을 사용하여 피어가 인증되지 않았습니다.

WebDriver driver = new HtmlUnitDriver(){ 
      protected WebClient modifyWebClient(WebClient client){ 
       try {     
        client = new WebClient(BrowserVersion.FIREFOX_3_6); 
        client.setUseInsecureSSL(true); 
        client.setUseInsecureSSL(true); 
        client.setThrowExceptionOnScriptError(false); 
        client.setPrintContentOnFailingStatusCode(true); 
        client.setThrowExceptionOnFailingStatusCode(true); 
        client.setCssEnabled(true); 
        client.setJavaScriptEnabled(true); 
        XTrustProvider.install(); // Allow all certs 
        SSLUtilities.trustAllHostnames();// to turn off the default hostname verification on HTTPS connection; 
        SSLUtilities.trustAllHttpsCertificates();// to turn off the default certificate validation on HTTPS 
       } catch (GeneralSecurityException e) { 
        // TODO Auto-generated catch block 
        e.printStackTrace(); 
       } 
       return client; 
       } 
      } ; 

누구에게 의견이 있습니까?

답변

1

나는 그것을 알아 냈다. 2011 년에 출시 된 2.9 버전의 HtmlUnit에서 버그가있는 것 같습니다. 소스에서 빌드 한 후 작동합니다!

관련 문제