Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
javax.net.ssl.SSLPeerUnverifiedException:未使用Selenium和HtmlUnit对对等方进行身份验证_Ssl_Selenium_Htmlunit - Fatal编程技术网

javax.net.ssl.SSLPeerUnverifiedException:未使用Selenium和HtmlUnit对对等方进行身份验证

javax.net.ssl.SSLPeerUnverifiedException:未使用Selenium和HtmlUnit对对等方进行身份验证,ssl,selenium,htmlunit,Ssl,Selenium,Htmlunit,我正试图加载一个带有Selenium的页面进行测试,但我一直收到这个javax.net.ssl.SSLPeerUnverifiedException:peer not authenticated错误。现在我尝试了许多不同的方法来允许它,但它根本不起作用 WebDriver driver = new HtmlUnitDriver(){ protected WebClient modifyWebClient(WebClient client){

我正试图加载一个带有Selenium的页面进行测试,但我一直收到这个javax.net.ssl.SSLPeerUnverifiedException:peer not authenticated错误。现在我尝试了许多不同的方法来允许它,但它根本不起作用

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

有人有什么建议吗?

我已经想好了。这似乎是2011年发布的HtmlUnit当前可用的2.9版本中的一个bug。我从源代码创建它,现在它可以工作了

我已经弄明白了。这似乎是2011年发布的HtmlUnit当前可用的2.9版本中的一个bug。我从源代码创建它,现在它可以工作了