I have been trying to access an HTTPS URL with the HTMLUnitDriver API of Selenium 2.0, but somehow the execution gets stuck at the “This Connection is Untrusted” window and and the control doesn’t return back. Following is the code I have tried working on after I got some hint from this thread:
WebDriver driver = new HtmlUnitDriver() {
protected WebClient modifyWebClient(final WebClient client) {
try {
client.setUseInsecureSSL(true);
} catch (GeneralSecurityException e) {
e.printStackTrace();
}
return client;
}
};
driver.get("https://172.25.194.91:8443/meta/homeScreen.do");
I’d highly appreciate any help to get it work .
The issue was something else and is resolved now:
HtmlUnitDriverusesWaitingRefreshHandlerwithout parameters and unfortunately that is inappropriate for some sites – for example,HtmlUnitDriverhangs on http://news.google.com.Cause & Scenario:
<meta http-equiv="refresh"...>directive in your HTML header.WaitingRefreshHandlerwaits for the time specified but after that time elapses, it again redirectsHtmlUnitDriverto get that page!Solution:
One needs to extend the
HtmlUnitDriverand override themodifyWebClientmethod to set a new (read: to clear the) refresh handler.