Enable Javascript

Please enable Javascript to view website properly

Toll Free 1800 889 7020

Looking for an Expert Development Team? Take 2 weeks Free 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 are 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 troubleshoot 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("https://www.google.com"); } }
automation-testing

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

automation-testing

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

From now on, We can use the newly created profile in our WebDriver scripts.

WebDriver Script for Using Custom Profile

To call custom profiles on Firefox, We must use the WebDriver inbuilt class(ProfilesIni). 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("https://www.google.com"); } }

Install your Firefox profile with the 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.

automation-testing

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

automation-testing

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

Software Development Team
Need Software Development Team?
captcha
🙌

Thank you!
We will contact soon.

Oops! Something went wrong.

Recent Blogs

Categories

NSS Note
Trusted by Global Clients