Selenium SSL 握手问题

发布于 2024-10-20 01:26:00 字数 1534 浏览 2 评论 0原文

在尝试访问测试门户时,我在使用 selenium.start("captureNetworkTraffic=true"); 模式时遇到以下问题。

HTTP ERROR: 400

Could not proxy https://myurl.com
java.lang.RuntimeException: Couldn't establish SSL handshake.  Try using trustAllSSLCertificates.
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

RequestURI=/auth/login

请注意,这种情况仅发生在 captureNetworkTrafficMode 中。一个简单的 selenium.start(); 完全可以正常工作。

这是访问代码 -

RemoteControlConfiguration settings = new RemoteControlConfiguration();
File f = new File("C:\\selenium-profile");
BrowserConfigurationOptions bco = new BrowserConfigurationOptions();
bco.setCommandLineFlags("-trustAllSSLCertificates");
bco.setCommandLineFlags("-disable-web-security");
bco.setCommandLineFlags("-avoidProxy");
settings.setFirefoxProfileTemplate(f);
settings.setReuseBrowserSessions(true);
settings.setSingleWindow(true);
SeleniumServer seleniumserver=new SeleniumServer(settings);
seleniumserver.boot();
seleniumserver.start();
selenium = new DefaultSelenium("localhost",4444,"*chrome","http://myurl.com") {
        public void open(String url) {
        commandProcessor.doCommand("open", new String[] {url,"true"});
                }
            };
selenium.start("captureNetworkTraffic=true");
selenium.open("/");

这个问题似乎已经被打死了,但我仍然没有找到令人信服的解决方案......大多数人建议创建自定义 FF 配置文件,但这不起作用。

While attempting to access a test portal, I'm encountering the following problem while using the selenium.start("captureNetworkTraffic=true"); mode.

HTTP ERROR: 400

Could not proxy https://myurl.com
java.lang.RuntimeException: Couldn't establish SSL handshake.  Try using trustAllSSLCertificates.
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

RequestURI=/auth/login

Note that this happens only in the captureNetworkTrafficMode. A simple selenium.start(); works with no problem at all.

Here's the access code -

RemoteControlConfiguration settings = new RemoteControlConfiguration();
File f = new File("C:\\selenium-profile");
BrowserConfigurationOptions bco = new BrowserConfigurationOptions();
bco.setCommandLineFlags("-trustAllSSLCertificates");
bco.setCommandLineFlags("-disable-web-security");
bco.setCommandLineFlags("-avoidProxy");
settings.setFirefoxProfileTemplate(f);
settings.setReuseBrowserSessions(true);
settings.setSingleWindow(true);
SeleniumServer seleniumserver=new SeleniumServer(settings);
seleniumserver.boot();
seleniumserver.start();
selenium = new DefaultSelenium("localhost",4444,"*chrome","http://myurl.com") {
        public void open(String url) {
        commandProcessor.doCommand("open", new String[] {url,"true"});
                }
            };
selenium.start("captureNetworkTraffic=true");
selenium.open("/");

This problem seems to have been beaten to death, but I still haven't come across a convincing solution...Most recommend the creation of a custom FF profile, but this doesn't work.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

牵强ㄟ 2024-10-27 01:26:00

它归结为一个额外的浏览器设置来信任所有 SSL 证书:

settings.setTrustAllSSLCertificates(true);

It boiled down to an additional browser setting to trust all SSL certificates:

settings.setTrustAllSSLCertificates(true);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文