Selenium SSL проблема рукопожатия - PullRequest
1 голос
/ 03 марта 2011

При попытке доступа к тестовому порталу при использовании режима 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 голосов
/ 09 августа 2011

Это сводилось к дополнительным настройкам браузера, чтобы доверять всем SSL-сертификатам:

settings.setTrustAllSSLCertificates(true);
...