Handle Chrome SSL certificate issue in Selenium

package SeleniumWebDriver;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.AfterTest;

public class SSLCertificateChrome {
    WebDriver driver;

    @Test
    public void SSLChrome() throws Exception {  
        
        DesiredCapabilities dc = DesiredCapabilities.chrome();
        dc.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
        System.setProperty("webdriver.chrome.driver", "/home/chinna/lib/chromedriver");
        driver = new ChromeDriver(dc);
        driver.get("https://www.seleniumlearn.com");

    }
    @BeforeTest
    public void beforeTest() {
        driver=new FirefoxDriver();
        driver.manage().window().maximize();
    }

    @AfterTest
    public void afterTest() {
    }

}

Tags: 

Comments