Thursday, 19 September 2013

How to Work with Firefox Profile with Selenium WebDriver

Create Firefox Profile with Profile Manager:

Close all open instance of Firefox Browser( use file->Exit Option)

go to Run and type - firefox.exe -p

Create a New Profile with profile manager.

Open the Relevant Profile with WebDriver:


Before calling FirefoxDriver Constructor, we have to perform following steps-
 Create an object of ProfilesIni Class

ProfilesIni in = new ProfilesIni();

Create an object of Firefox profile

FirefoxProfile profile

Call a method getAllProfiles that is exist in ProfilesIni Class, which will return Firefox Profiles

profile = in.getProfile("Provide name of Firefox Profile you want to interact with");

Now simply Create object of Webdriver with FirefoxDriver Class Constructor

WebDriver driver = new FirefoxDriver(profile);

No comments:

Post a Comment