How to disable firstRun page for FirefoxDriver?

When you are a newbie for Selenium WebDriver with FirefoxDriver, you might have got irritated with firstRun page of firefox.

Every time you run your script on FirefoxDriver, the browser opens with the firstRun page.

(URL : https://www.mozilla.org/en-US/firefox/46.0/firstrun/learnmore/).

This type of issue occurs because of incompatibility between Firefox version and Selenium WebDriver API version.

Here, I am using Firefox 46.0 version and selenium-java-2.45.0 for WebDriver.

//https://www.mozilla.org/en-US/firefox/46.0/firstrun/learnmore/
firstRun page opened with firefoxdriver
It will not even execute a single line of the automation script you have written and throw below run-time errors on console.

org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms.

Latest Firefox browser versions comes with default signed extensions setting to TRUE, and it leads to the firstRun page always.

So, we need to programmatically set the default signed extensions setting property to FALSE.

We can set firefox browser specific properties using the FirefoxProfile class provided in WebDriver API.

Lets have a look at the solution.

// creating a firefox profile

FirefoxProfile fp = new FirefoxProfile();

// disabling firefox add-on signing requirement through FirefoxProfile
fp.setPreference(“xpinstall.signatures.required”, false);

// instantiating FirefoxDriver instance with set FirefoxProfile instance
WebDriver driver = new FirefoxDriver(fp);

driver.get(“www.google.com”);

System.out.println(driver.getTitle());

driver.quit();

Hope it works for you!

Cheers 🙂

Advertisements

#disable-first-run-page-in-firefox, #firefoxprofile