Tuesday, November 4, 2014

Selenium:Create firefox profile with addons and preferences

Selenium:Create firefox profile with addons and preferences

 

Note : If you already have a profile with Firebug added then use :
System.setProperty("webdriver.firefox.profile", "default");
//to find profile name - Start>Run >firefox -ProfileManager

1. Close all firefox instances ,verify the same if any firefox instance is running in the task manager.
2. Goto Start>Run and type "firefox -ProfileManager"
3. click "OK"
4. Firefox "Choose profile" should open.
5. Click on "Create Profile"button.
6. Click on next button in following screen
7. Enter profile name in the next screen and choose the path where you want to save it (ex. D:\profile)
8. Click on finish.
9.  Now uncheck "use the selected profile without asking at startup"
10. Select the profile which has been created .
11 click on "Start firefox ".

Now the firefox will be open with the selected profile.

12. Do required settings and add any addons needed and restart firefox.
13. Now when firefox opens check "use the selected profile without asking at startup"
14. Select default profile.
15 Click on "Start Firefox".


In your Selenium use the below code :

File profileDir = new File("D:\\profile");  //("path/to/top/level/of/profile");
FirefoxProfile profile = new FirefoxProfile(profileDir);
profile.setPreferences(extraPrefs);
WebDriver driver = new FirefoxDriver(profile);

1 comment:

  1. Interest to learn Selenium Online Training by Real Time Software Testing Professional Trainer having 10+ Years of Expert.
    Selenium Training

    ReplyDelete