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

09 January, 2014
While automating web based applications we may encounter problems with Security Cerificates(UntrustedSSLCertificates. Just use this simple code below to cross the SSL page.


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

If you are using TestNG framework below 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 SecurityCertificate {  
  
 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()");   
 }  
}

No comments:

Post a Comment