gpt4 book ai didi

ssl - javax.net.ssl.SSLPeerUnverifiedException : peer not authenticated using Selenium and HtmlUnit

转载 作者:太空宇宙 更新时间:2023-11-03 13:28:56 25 4
gpt4 key购买 nike

我试图用 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 年发布的当前可用的 2.9 版本的 HtmlUnit 中的一个错误。我从源代码构建它,现在它可以工作了!

关于ssl - javax.net.ssl.SSLPeerUnverifiedException : peer not authenticated using Selenium and HtmlUnit,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11494699/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com