Handle Firefox SSL certificate issue in Selenium

package SeleniumWebDriver;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.AfterTest;

public class SSLCertificateFirefox {
    WebDriver driver;

    @Test
    public void SSLFirefox() throws Exception {  
        driver.get("https://www.seleniumlearn.com/");
        FirefoxProfile fp = new FirefoxProfile();
        fp.setAcceptUntrustedCertificates(true);
        fp.setAssumeUntrustedCertificateIssuer(false);
        driver=new FirefoxDriver(fp);
    }
    @BeforeTest
    public void beforeTest() {
        driver=new FirefoxDriver();
        driver.manage().window().maximize();
    }

    @AfterTest
    public void afterTest() {
    }

}

Tags: 

Comments