How To Create And Use Custom Firefox Profile For Selenium WebDriver

What Is the Firefox Profile?
When yous Install Firefox In your computer, Firefox creates 1 default profile folder In your local motility to salvage your preferences similar your bookmarks, your preferred dwelling solid page on Firefox open, your toolbar settings, your saved passwords in addition to all the other settings. You tin create unlike profiles for your Firefox browser equally per your software testing requirement. Now supposing same reckoner Is used past times 2 users in addition to both wants their ain Firefox settings in addition to hence both users tin exercise their ain Firefox profile to access their ain settings when he/she opens Firefox browser.

You tin LEARN SELENIUM WEBDRIVER STEP BY STEP to buy the farm primary of selenium Webdriver software testing tool.

If yous convey noticed, When yous volition run your selenium webdriver software automation bear witness In Firefox browser in addition to hence WebDriver volition opened upward blank Firefox browser similar No bookmarks, No saved passwords,  No addons etc.. equally shown In bellow given Image.


If yous wants access of all these things In your selenium webdriver software automation bear witness browser in addition to hence yous convey to exercise novel profile of Firefox in addition to fix all required properties In newly created profile in addition to and hence yous tin access that profile In webdriver using FirefoxProfile degree of webdriver.

First Of all, Let us meet how to exercise novel profile of Firefox in addition to and hence nosotros volition meet how to role that profile In your test.

How to Create New Custom Firefox Profile For Selenium WebDriver?
To exercise novel firefox profile manually,

  • Close Firefox browser from File -> Exit.
  • Go to Start -> Run in addition to type "firefox.exe -p" In run window in addition to click OK. It volition opened upward "Firefox - Choose User Profile" dialogue equally shown In bellow Image.




  • Now click on Create profile button. It volition opened upward exercise profile sorcerer dialogue. Click On Next equally shown In bellow given Image.
  • On adjacent screen, Give profile mention = "WebDriver_Profile" in addition to click on complete push clitoris equally shown In bellow given Image.

  • It Will exercise novel profile of Firefox. 
  • To role that newly Created profile, Select that profile in addition to click on Start Firefox push clitoris equally shown In bellow given Image. It volition opened upward Firefox browser alongside newly created profile.
Now yous tin brand yous required settings on this novel created profile browser similar add together your required addons, bookmark your required page, network settings, proxy settings, etc.. in addition to all other required settings.

How To Access Custom Firefox(Changing User Agent) Profile In Selenium WebDriver Test
To access newly created Firefox profile In selenium WebDriver software test, We needs to role webdriver's Inbuilt class ProfilesIni in addition to Its method getProfile equally shown In bellow given example. 

package Testng_Pack;  import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.firefox.FirefoxProfile; import org.openqa.selenium.firefox.internal.ProfilesIni; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test;  world degree custom_profile {  WebDriver driver;    @BeforeTest  world void StartBrowser() {   //Create object of webdriver's inbuilt degree ProfilesIni to access Its method getProfile.   ProfilesIni firProfiles = novel ProfilesIni();   //Get access of newly created profile WebDriver_Profile.   FirefoxProfile wbdrverprofile = firProfiles.getProfile("WebDriver_Profile");   //Pass wbdrverprofile parameter to FirefoxDriver.   driver = novel FirefoxDriver(wbdrverprofile);    }    @Test  world void OpenURL(){   driver.get(" ");    }    @AfterTest  world void CloseBrowser() {   driver.quit();    } }

When yous volition run higher upward given example, It volition opened upward Firefox browser alongside newly created profile settings. 

Why needs To Set Firefox Profile In Selenium WebDriver
To perform simply about actions In your selenium webdriver software automation test, You require exceptional Firefox profile. Some instance actions are equally bellow where nosotros require to fix Firefox profile. We volition larn to a greater extent than well-nigh how to perform all those actions In Selenium webdriver software automation testing tool In my upcoming posts.

1. To Download files.   VIEW EXAMPLE
2. To Set Proxy Settings. VIEW EXAMPLE
3. To Resolve Certificate related errors. VIEW EXAMPLE

If yous convey whatever instance where nosotros require to fix Firefox profile properties in addition to hence yous tin portion It alongside globe past times commenting bellow.

More interesting articles here :Generation Enggelmundus Internet Marketing Tool here :Zeageat IM

http://www.software-testing-tutorials-automation.com/
Post a Comment (0)
Previous Post Next Post