Thursday 2 May 2013

How we can handle SSL certificate error in IE with selenium webdriver ?

What is SSL Certificate errors?

Certificates are not trusted in Web Browsers. 

For Eg. If we access Paypal Website without www, web browser will show SSL certificate error.

Like "https://paypal.com". 

In selenium Webdriver, How we can handle this issue?

Here is the simple solution for this SSL certificate error.

 driver.navigate().to("javascript:document.getElementById('overridelink').click()");




import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.testng.annotations.Test;

public class SSLerror{
private WebDriver driver;

@Test
public void TestSSLerror() {
System.setProperty("webdriver.ie.driver",E:\\IEDriverServer_Win32_2.28.0\\IEDriverServer.exe"); 
   driver = new InternetExplorerDriver();
   driver.get("https://ultra-erp.com/Ultratiles/Default.aspx");
   driver.navigate().to("javascript:document.getElementById('overridelink').click()");  

}