Handle SSL certificate issue in Selenium / firefox

Selenium creates a new and clean profile each time it runs a test, so it won't keep any cookies of the previous session and it wont use any browser plug-in however you can force selenium to use your own profile.

1. Close all instances of firefox browser.
2. Create a new firefox profile : Go to Run and type firefox -p and press OK . This will open a dialog bod where you create new firefox profile, have a name "xxx" and save it in C: drive.
3. Install all plug-ins in this profile ; For SSL certificate issue install SSL security bypass


4. Now you write you test cases like below

import org.openqa.selenium.server.RemoteControlConfiguration;
import org.openqa.selenium.server.SeleniumServer;
import org.testng.annotations.*;
import com.thoughtworks.selenium.*;
import java.io.File;

public class firefoxprofile extends SeleneseTestCase {

private SeleniumServer seleniumServer;
private Selenium selenium;
public static final String MAX_WAIT_TIME_IN_MS="60000";

public void setUp() throws Exception {

File template = new File("C:\\xxxxxx");
RemoteControlConfiguration rc = new RemoteControlConfiguration();
seleniumServer = new SeleniumServer(rc);
selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://www.google.com/");


public void googling() {
selenium.type("q", "http://automationtricks.blogspot.com");

public void tearDown() throws InterruptedException{



As soon as your tests redirect to an HTTPS URL on the same host, where your SSL certificate is self-signed, things go wrong. As Selenium effectively runs Firefox with a new profile every time, you potentially lose any certificate exceptions you might accept.
One technique we were using was to create a custom profile; run Firefox using that profile; browse to the HTTPS URL and accept the exception into that profile; then close the profile.

Steps to create a Firefox profile:
1. Close down any running Firefox instances.
2. Start Firefox (the one you're going to run your tests with) with the profile manager: firefox –ProfileManager using command prompt.
3. Create a new profile. You'll be prompted to choose a directory for the profile. Put it somewhere inside the project where you're writing the tests.
4. Select the profile and run Firefox using it.
5. Browse to the HTTPS URL (with self-signed certificate) you're going to be testing against.
6. Accept the self-signed certificate when prompted. This creates an exception for it in the profile.
7. Close the browser.
8. Go to the Firefox profile directory.
9. When you run your Selenium server, pass a -firefoxProfileTemplate /path/to/profile/dir argument to it. This tells Selenium to use your partial profile (with certificate exceptions) as a basis for minting its new profile. So you get the certificate exceptions, but without any of the other clutter you would get if you used a whole profile.

command for using the firefox profile template in selenium server.

java -jar selenium-server.jar -firefoxProfileTemplate /path/to/profile \
-htmlSuite “*chrome firefox-bin” “http://host.com” “testSuite.html” “seleniumResults.html” 


  1. It will surely spread technical awareness in people. Thanks for writing. People can also visit a website, mysslonline mysslonline to install SSL certificate

  2. Good to know about Self-signed certificates do have their advantages. They are free to generate and are fine for use on intranet and development servers where the only people expected to trust the server are internal personnel such as company employees. However, they should never be deployed on commercial websites that the general public are expected to trust.
    Follow the link for Selenium Certification:
    Selenium Training
    | Selenium Training in Chennai

  3. This comment has been removed by the author.

  4. Nice Sharing about SSL Certificate provider in chennai. This blog has very informative contents, this is what i was searched for long times.

  5. Selenium WebDriver fits in the same role as RC did, and has incorporated the original 1.x bindings. It refers to both the language bindings and the implementations of the individual browser controlling code. This is commonly referred to as just "WebDriver" or sometimes as Selenium 2.
    Selenium Training Institute in Chennai
    Best Selenium Training Institute in Chennai
    Selenium Training Course

  6. It is a free Open Source test automation framework that works with any tool (Selenium,Python and C# code or test tools like Selenium, Appium, etc.) can be used Learn looked for
    Hadoop Training in Chennai
    Selenium Training in Chennai
    Software Testing Training in Chennai

  7. This blog is so nice to me. I will keep on coming here again and again. Visit my link as well.. Search Bar Firefox 57 Quantum addon