1

I am attempting to load a page with Selenium for testing, but I keep getting this javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated error. Now I have tried MANY different ways of allowing it, but it simply will not work!

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;
               }
            } ;

Does anyone have suggestions?

1 Answer 1

1

I have figured it out. It seems to be a bug in HtmlUnit with the currently available 2.9 version released in 2011. I built it from source and now it works!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.