JavaScript Required

We're sorry, but we doesn't work properly without JavaScript enabled.

Looking for an Expert Development Team? Take two weeks Trial! Try Now

Profile Creation for Automation Testing

Firefox Profile

As per Mozilla “Firefox saves your personal information such as bookmarks, passwords, and user preferences in a set of files called your profile”. A person can have multiple profiles created each having a separate set of information.

Need for a profile?

Whenever Firefox is launched by Selenium WebDriver the plugins and settings present in our default profile is not available as each instance of a driver creates a temporary profile. To view the temporary profile launch the WebDriver instance and once the Firefox browser opens navigate to help and troubleshooting to view profile information.

public class FirefoxProfile { public static void main(String[] args) { System.setProperty("webdriver.gecko.driver", "C:\\driver\\geckodriver.exe"); WebDriver driver = new FirefoxDriver(); driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); driver.get(""); } }

Click on Show Folder button to view the details of the temporary profiles created.


Profile Creation in Firefox

We can create our own Firefox profiles and can call that specific profile each time when we automate using WebDriver so that our execution will be more efficient and reliable. Some scenarios like handling of SSL certificates are also done by custom profile creation.

Steps to create profile

  1. Open Run command
  2. Type firefox.exe -p and click on ok
  3. A dialog box will be open → Firefox-Choose User Profile
  4. automation-testing
  5. Select Create Profile button and click on next
  6. Enter Profile name and click on finish button
  7. automation-testing
  8. Now verify the profile creation in very first pop up that appeared
  9. automation-testing

We can use the newly created profile in our WebDriver scripts from now on

WebDriver Script for Using Custom Profile

We must use WebDriver inbuilt class(ProfilesIni) for calling custom profiles of Firefox. The getProfile() method will help us in calling the created Firefox profile

import java.util.concurrent.TimeUnit; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.firefox.internal.ProfilesIni; import org.openqa.selenium.firefox.FirefoxProfile; public class FirefoxProfileCreate { public static void main(String[] args) { System.setProperty("webdriver.gecko.driver", "C:\\driver\\geckodriver.exe"); ProfilesIni profile = new ProfilesIni(); FirefoxProfile fox = profile.getProfile("SeleniumTest"); WebDriver driver = new FirefoxDriver(fox); driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); driver.get(""); } }

Install your Firefox profile with Firebug extension and close the browser. Now use the above code to run your profile. Verify the instance of Firefox browser also has firebug extension with it


Now run the initial code of WebDriver without profile and you can see that Firebug extension is missing in that


Hope this will help you to create the profile using Selenium webdriver and if you feel difficult at any step then comment your questions here or you can go for a Software testing company to get solutions.

Now learn about integration of Maven & Jenkins with Selenium

Recent Blogs


NSS Note

Some of our clients