Customizing the Firefox Profile and using with Selenium Web Driver

12 / Dec / 2014 by Gaurav Gupta 0 comments

What is Firefox Profile

Firefox saves your browser information such as Bookmarks, Downloads and Browsing History, etc in a set of files called profile, which is stored in a specified location by Firefox in user file directory.

You can have multiple Firefox profiles, each containing a separate set of user information. The Profile Manager allows you to createremoverename, and switch profiles.


Why I need a New Profile

The default Firefox profile is not very automation friendly.  When you want to run automation reliably on a Firefox browser it is advisable to make a separate profile. Automation profile should be light to load and have desired plug ins to run and debug the test while writing automation test suite.

1- You may want to set the User preferences of the browser like home page URL,which you want to use as your home page. The Firefox profile which web driver open does not have such preference with it, till you not have set it explicitly to the Firefox profile.

2- Each time Selenium starts a new session driving a Firefox instance, it copies the entire profile in some temporary directory and if the profile is big, it makes it, not only slow but unreliable as well. Using a specified profile will not load a profile each time hence make it fast and more reliable.


Make a New Profile using Firefox profile manager


Step 1: Starting the Profile Manager
  1. Close the Firefox browser
  2. Press ‘ Window + R’ or click on the Windows Start Menu and then select Run.
  3. In the Run dialog box, type in: ‘firefox.exe -p and then Click OK.
  4. The Choose User Profile window will look like this.


Step 2: Creating a Profile
  1. Click the ‘Create Profile…’ button on the ‘Firefox – Choose User Profile’ window
  2. Click ‘Next >’ in the ‘Create Profile Wizard’ window
  3. Type in a new profile name ‘QAProfile’ in the ‘Enter new profile name box and click ‘Finish’.







Step 3: Use Custom Profile in Selenium

ProfilesIni profile = new ProfilesIni();

FirefoxProfile myprofile = profile.getProfile("QAProfile");

WebDriver driver = new FirefoxDriver(myprofile);


Gaurav Gupta


Leave a Reply

Your email address will not be published. Required fields are marked *