[selenium] Handling "Untrusted SSL certificate" error in firefox

http://eloraparija.com/firefox-profile/

Sometimes we see the below error while accessing a website.Then how to handle that error???

This connection is untrusted.

You have asked Firefox to connect securely to mail.google.com,but we can’t confirm that your connection is secure.

 

You need to use firefox profile here.

 

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;


public class CrossBrowser {

	private static WebDriver driver;
	private static String browserType="FIREFOX"; 
	public static void main(String[] args) {

		if(browserType.equals("FIREFOX")){
		FirefoxProfile profile = new FirefoxProfile();
    		profile.setEnableNativeEvents(true);	
    		profile.setAcceptUntrustedCertificates(true);
    		profile.setAssumeUntrustedCertificateIssuer(true); 
		    driver=new FirefoxDriver(profile);
     }
}

 

We can use the profile concept only in firefox.

 

posted @ 2015-11-17 17:24  清水荷  阅读(235)  评论(0编辑  收藏  举报