My Thoughts: Handling Security Certificates in Firefox using WebDriver

Sunday, May 20

Handling Security Certificates in Firefox using WebDriver

In the Previous Post we have discussed how to handle Security Certificates in IE using WebDriver.

Now it is time for Firefox :)

Handling SSL issues in firefox are easy too. This can be done easily by setting
setAcceptUntrustedCertificates=true

Here is the sample code using TestNG framework :
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public void SecurityAlerts(){

WebDriver driver;

@BeforeTest
public void setUpDriver() {
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("setAcceptUntrustedCertificates","true");
driver = new FirefoxDriver(profile);
         }

@Test
public void Start(){
driver.get(URL);
         }
 }



3 comments:

  1. very simple solution...:)
    good one

    ReplyDelete
  2. One of the best, simple way to handle SSL
    Thanks Vamshi :)

    ReplyDelete
  3. How to do in android webdriver...

    ReplyDelete