How to use Firefox Profile preferences in Selenium Webdriver


There are many advantages by using FirefoxProfile preferences in selenium. You have to update the preferences within Firefox. We can do this by instantiating a Firefox Profile object and then update the settings.We will then need to pass this object into FirefoxDriver which will load the profile with your defined settings.

1. How to setup the startup page in Firefox browser

FirefoxProfile profile= new FirefoxProfile();


WebDriver driver = new FirefoxDriver(profile);

2. How to set language in profile ?

FirefoxProfile profile= new FirefoxProfile();

profile.setPreference( “intl.accept_languages”, “no,en-us,en” );

WebDriver driver = new FirefoxDriver(profile);

3. How to Change the user agent ?

FirefoxProfile profile = new FirefoxProfile();
.setPreference(“general.useragent.override”, “Any UserAgent String”);
WebDriver driver = new FirefoxDriver(profile);

4. How to Download the files using firefox profile ?

FirefoxProfile profile = new FirefoxProfile();

profile.setPreference(“”,2);  profile.setPreference(“”, false); profile.setPreference(“”, downloadPath); profile.setPreference(“browser.helperApps.neverAsk.openFile”,”application/excel”);


profile.setPreference(“browser.helperApps.alwaysAsk.force”, false);

profile.setPreference(“”, false); profile.setPreference(“”, false);

5. How to handle SSL certificate error (Firefox browser) ?

 FirefoxProfile profile = allProfiles.getProfile("CertificateIssue");
 WebDriver driver = new FirefoxDriver(profile);

I hope this helps you  a lot…!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s