Sunday 29 May 2022

How To Handle Insecure Connection / Untrusted Certificate Error in Selenium on Chrome, Firefox, Edge

                    In this post, we will see How To Handle Insecure Connection / Untrusted Certificate Error in Selenium on Chrome, Firefox, Edge 


Program Code:

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;

import org.openqa.selenium.chrome.ChromeOptions;

import org.openqa.selenium.edge.EdgeOptions;

import org.openqa.selenium.firefox.FirefoxOptions;


public class AcceptInsecureSSL {


public static void main(String[] args) {

System.setProperty("webdriver.chrome.driver", "C:\\selenium\\chromedriver_win32\\chromedriver.exe");

ChromeOptions options=new ChromeOptions();

//FirefoxOptions options=new FirefoxOptions();

//EdgeOptions options=new EdgeOptions();

options.setAcceptInsecureCerts(true);

WebDriver driver=new ChromeDriver(options);

driver.get("https://expired.badssl.com/");

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


}



Watch following video:


Watch on YouTube: https://www.youtube.com/watch?v=iSHXhFOVw-o

 

No comments:

Post a Comment