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.
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
- Open Run command
- Type firefox.exe -p and click on ok
- A dialog box will be open → Firefox-Choose User Profile
- Select Create Profile button and click on next
- Enter Profile name and click on finish button
- Now verify the profile creation in very first pop up that appeared
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
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