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.
Click on the 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
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
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.
Now run the initial code of WebDriver without profile and you can see that the Firebug extension is missing in that
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.