javax.net.ssl.SSLPeerUnverifiedException:未使用Selenium和HtmlUnit对对等方进行身份验证
我正试图加载一个带有Selenium的页面进行测试,但我一直收到这个javax.net.ssl.SSLPeerUnverifiedException:peer not authenticated错误。现在我尝试了许多不同的方法来允许它,但它根本不起作用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){
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。我从源代码创建它,现在它可以工作了