Selenium SSL握手问题

时间:2011-03-03 16:29:58

标签: selenium selenium-rc

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

HTTP错误: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配置文件,但这不起作用。

1 个答案:

答案 0 :(得分:0)

它归结为另一个浏览器设置,以信任所有SSL证书:

settings.setTrustAllSSLCertificates(true);