top of page
Search

How to handle HTTPS sites Or Security Certificate Errors using Selenium Web Driver (IE)

  • qatestingthreesixt
  • Dec 1, 2021
  • 1 min read

Sometimes while testing on secure sites we may encounter with Security Certificate Errors. You may refer to following code to deal with HTTPS Sites or Certificate Errors:


CODE:

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.ie.InternetExplorerDriver;

import org.testng.Assert;

import org.testng.annotations.AfterTest;

import org.testng.annotations.BeforeTest;

import org.testng.annotations.Test;


public class HTTPS_handling {

WebDriver driver;

@Test

public void httpsTest() throws Exception {

driver.get("https://site url");

//Java script to click the link

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

Thread.sleep(5000);

//assert the title of the page

Assert.assertEquals(driver.getTitle(), "site title");

System.out.println("asssert successfull");

Thread.sleep(5000);

}

@BeforeTest

public void beforeTest() {

//launch Internet explorer

System.setProperty("webdriver.ie.driver", "D:\\Tools\\Selenium\\IEDriverServer_x64_2.47.0\\IEDriverServer.exe");

driver=new InternetExplorerDriver();

driver.manage().window().maximize();

driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);

}

@AfterTest

public void afterTest() {

driver.close();

driver.quit();

}

}



 
 
 

Recent Posts

See All

Comments


Contact Us

PR World Trade Center, 108, near bus stand, Jalandhar, Punjab 144001

Phone or Whatsapp

+91-7652933997

     

bottom of page