Firefox Profile in Selenium : How to Create & Use Firefox Profile in Selenium?

Firefox Profile in Selenium - How to Create & Use Firefox Profile in Selenium?

Firefox's profile is one of the important feature about the Firefox, We need profile if we want to Customize out.

Contents

Why do we need a Firefox Profile?

  • To create your own automation profile that you can use in Automation.

  • Every time the same profile is used so that the download folder and other things are be cached or the same.

  • You can install custom add-on which are always available in the Firefox profile.

E.g. We are using a multi pass add-on which allows us to automatically bypass the basic auth popup.

How to create Firefox Profile?

  1. Open the Firefox and open this URL “about:profiles”

  2. Click on the create new profile.

  3. Open that profile and install your favorite add-ons like ad blocker, multipass for this demo to work.

Firefox profile setup in selenium

How to Customize Download folder, and other add-on to Firefox profile?

  1. You can customize the download folder if you are testing some download functionality in the selenium with the profile.

  2. This is helpful in downloading and verifying file test cases, you can use the hard coded path in the profile every time. 

  3. Customize downloads, and added add-on are available in Profile every time you launch the profile with the Firefox profile options.

firefox profile with multipass extension

How to bypass Basic auth using Firefox Profile in Selenium?

Suppose you have a test case where you have to open a basic auth popup. Problem with the Basic auth is that it is popup and very hard to automate in Selenium.

You can’t directly use the driver.switchTo() method here.

Now You can use these methods 

Method 1 :
Easy way to open the URL with the https://username:password@website.com , so the URL for the demo becomes https://admin:admin@the-internet.herokuapp.com/basic_auth

 But for some websites it doesn’t work, We have to use certain add-ons to handle the popup, thankfully we have a plugin like multi pass where you can save the username, password and URL it will automatically put all the details.

Method 2:

So steps are

  1. Just create a Profile with multi pass add-on and URL with details or credentials.
  2. Open the URL in the same profile.
  3. Multi pass will automatically put the credentials and login to the portal.
  4. Verify the home page.

Similar Posts

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.