[selenium] Handling “Untrusted SSL certificate” error in firefox

  • Post author:
  • Post category:其他



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.

转载于:https://www.cnblogs.com/qingshuihe/p/4972339.html