My Thoughts: Testing
Showing posts with label Testing. Show all posts
Showing posts with label Testing. Show all posts

Friday, May 11

Handling Security Cerificates(UntrustedSSLCertificates) in Internet Explorer (IE) using WebDriver(selenium2)

In automating web based application we will find problem with Security Cerificates(UntrustedSSLCertificates).

And here is a simple solution for this.Just use the below code to cross the SSL page :)

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


If you are using TestNG framework then here is the sample code :

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

public class SecurityCerts {

 WebDriver  driver;

 @BeforeTest
 public void setUpDriver(){ 
   driver = new InternetExplorerDriver();
    }

 @Test
 public void start(){
 driver.get("https://www.hs.facebook.com/help/community/question/?id=648015478541882");  
 driver.navigate().to("javascript:document.getElementById('overridelink').click()"); 
 }

}