42

How to disable this "first run" page once and for all for FF?

When FF driver is created, it opens tab with - https://www.mozilla.org/en-US/firefox/42.0/firstrun/learnmore/ and additional tab with target page.

divide by zero
  • 2,340
  • 5
  • 23
  • 34

9 Answers9

23

To turn off this annoying start page:

More protection. The most privacy. Mozilla Firefox firstrun screen

in C# with Selenium 2.48 I found the following solution:

FirefoxProfile prof = new FirefoxProfile();
prof.SetPreference("browser.startup.homepage_override.mstone", "ignore");
prof.SetPreference("startup.homepage_welcome_url.additional",  "about:blank");
Driver = new FirefoxDriver(prof);

...and it will never bother you again.

Note: One of these settings alone will also work. I use them together to make it bullet-proof.

Elmue
  • 7,602
  • 3
  • 47
  • 57
  • 1
    In python it will look like this: `prof = webdriver.FirefoxProfile() prof.set_preference("browser.startup.homepage_override.mstone", "ignore") prof.set_preference("startup.homepage_welcome_url.additional", "about:blank") browser = webdriver.Firefox(prof)` – Ilya Jul 30 '16 at 11:50
10

Ifound a solution, works fine

FirefoxProfile fp = new FirefoxProfile();
fp.setPreference("browser.startup.homepage", "about:blank");
fp.setPreference("startup.homepage_welcome_url", "about:blank");
fp.setPreference("startup.homepage_welcome_url.additional", "about:blank");
Sjon
  • 4,989
  • 6
  • 28
  • 46
pardill0
  • 101
  • 3
  • Where in our scripts would we put this? – jagdpanzer Dec 03 '15 at 14:43
  • It seems to be a Java solution. What about a Python/Django solution? – Randy Tang Dec 09 '15 at 14:56
  • 1
    Pretty much the same, except use set_preference() in Python: http://selenium-python.readthedocs.org/faq.html#how-to-auto-save-files-using-custom-firefox-profile – Spooner Dec 22 '15 at 13:52
  • 1
    Echoing @jagdpanzer - where do we put this? It's not a particularly helpful answer given the code presumably has to be somewhere very specific. – Andy Gout Dec 22 '15 at 23:23
  • The last line of your code is enough. The other options are already set by the webdriver (at least in 2.48). – Elmue Jan 05 '16 at 22:00
9

I have faced the same problem. I have just changed the Selenium version to 2.48 and the problem solved.

  • 1
    Accusing him for anything is not nice also... . – Martin Kersten Jan 12 '16 at 14:13
  • I'm not sure the difference Elmue, but upgrading to 2.48.1 fixed it for me as well. – Brandon Jan 13 '16 at 18:22
  • 1
    This can be solved by having matching Selenium and Firefox versions. The reason it would be solved for one person by switching to Selenium 2.48 and not another is if you have different Firefox versions. Generally you want to be at least 1-2 versions behind the newest Firefox that was out during the lifecycle of a particular Selenium version. – emery Feb 09 '16 at 17:18
  • 1
    Just had this problem with python Selenium 2.48 and Firefox 45.0.1. `pip install --upgrade selenium` upgraded selenium to 2.53.1 and resolved the issue for me. – Steve Kallestad Mar 28 '16 at 20:43
5

This is caused by incompatibility between Selenium and Firefox versions, but not by any one specific version number.

You should be 1-2 Firefox versions behind the newest, if your WebDriver is on the latest version. Otherwise, roll the Firefox version back even further if your WebDriver is older, or upgrade Webdriver.

To get an older Firefox, try https://ftp.mozilla.org/pub/firefox/releases/ or http://www.oldapps.com/

or on Linux, depending on your distro

yum list --showduplicates firefox
sudo yum install firefox-<version>

or

apt-cache show firefox | grep Version
sudo apt-get install firefox=<version>
emery
  • 8,603
  • 10
  • 44
  • 51
  • 1
    Thanks, I appreciate your answer! – divide by zero Feb 10 '16 at 08:19
  • 1
    This solved it for me by going back two versions. URL for downloads: https://ftp.mozilla.org/pub/firefox/releases/ – Taylored Web Sites Mar 03 '16 at 15:26
  • actually, it was a bug that has since been fixed. opening the "first run" page has absolutely nothing to do with an "incompatibility between Selenium and Firefox versions" – Corey Goldberg Apr 22 '17 at 12:48
  • Glad that it has been fixed @CoreyGoldberg -- but a lot of problems can be solved by finding the best combination of selenium and browser version. This is true whether or not the versions are the root cause of the bug. – emery Apr 22 '17 at 22:43
  • @emery sure.. that may be true. but your post still doesn't actually answer the question in any way. – Corey Goldberg Apr 23 '17 at 02:39
  • @emery rather than guessing about compatibility, you could just read the release notes where any known compatibility issues are disclosed. – Corey Goldberg Apr 23 '17 at 02:45
  • Changing Firefox/Selenium versions worked for several people on this thread. It's a valid solution, but not the only solution. Testing the various version matches is a good idea to address a variety of Selenium issues. – emery Apr 23 '17 at 18:23
3

C# solution, upgraded Selenium WebDriver to 2.49.0 solved the issue for me.

Bleeped
  • 469
  • 7
  • 16
1

The above solutions do not work, I've tried them. What did work for me, and probably will for you (if using firefox 43 or less) is:

    prof.setPreference("xpinstall.signatures.required", false);
    prof.setPreference("toolkit.telemetry.reportingpolicy.firstRun", false);

The problems with 43 and selenium are twofold, the default signed extensions setting (to true) and the first run page. These lines solve both. These must be set programatically. If you try to set them in about:config (or directly in prefs.js) it will not affect the new browsers you open with selenium. It should be noted that they say firefox 44 will not allow you to set the signed extensions variable (so this will not work on 44).

I include the codeblock from my now working code showing the correct use:

    FirefoxProfile prof = new FirefoxProfile();
    //FirefoxProfile prof = profile.getProfile("default");
    //prof.setPreference("browser.startup.homepage", proteinPageUrl);
    //prof.setPreference("startup.homepage_welcome_url", proteinPageUrl);
    //prof.setPreference("startup.homepage_welcome_url.additional", proteinPageUrl);
    prof.setPreference("xpinstall.signatures.required", false);
    prof.setPreference("toolkit.telemetry.reportingpolicy.firstRun", false);
    //Object socketLock = new Object();
    //synchronized(socketLock){

    //driver = new FirefoxDriver();
    driver = new FirefoxDriver(prof);

        //driver = forceInit();
        //driver.open();
    //}//end synch block

    //get protein page
    boolean done = true;
    do{
        driver.get(proteinPageUrl);

        final Wait<WebDriver> waitDriver = new FluentWait<WebDriver>(driver)
                   .withTimeout(30, java.util.concurrent.TimeUnit.SECONDS)
                   .pollingEvery(5, java.util.concurrent.TimeUnit.SECONDS);
        try{
            inputTextFeildElement = waitDriver.until(new Function<WebDriver,WebElement>(){
                public WebElement apply(WebDriver diver){
                    return driver.findElement(By.name("term"));
                    }});
        }

        catch(NoSuchElementException nsee){
            //if not find by name try find by id
            if(driver.findElements(By.id("term")).size() != 0){
                try{
                    inputTextFeildElement = driver.findElement(By.id("term"));
                    done = true;
                } catch(NoSuchElementException nsee2){
                    synchronized(threadLogFile){
                        try {
                            threadLogWriter = new PrintWriter(new FileWriter(threadLogFile.getAbsoluteFile(), true));
                        } catch (IOException ioe) {
                            System.out.println("error opening file for append: " + ioe.getMessage());
                            ioe.printStackTrace();
                        }//catch
                        threadLogWriter.println("Thread Id: " + threadId + " with thread name: " + threadName + " fails to find input element by name or id to put accession: " + accession);
                        threadLogWriter.flush();
                        threadLogWriter.close();
                    }//synchronized
                    done = false;
                }//catch nsee2
            }//catch nsee
        }
        catch(ElementNotVisibleException enve){
            done = false;
        }
    }while(!done);  
1

If you using selenium webdriver from Capybara/Cucumber, then you can change the default url when you register your driver using startup.homepage_welcome_url.additional:

Capybara.register_driver :firefox do |app|
  profile = Selenium::WebDriver::Firefox::Profile.new
  profile['browser.startup.homepage_override.mstone'] = 'ignore'
  profile['startup.homepage_welcome_url.additional'] = 'about:blank'

  Capybara::Selenium::Driver.new(app, :browser => :firefox, :profile => profile)
end
Sam3k
  • 960
  • 1
  • 11
  • 22
0

I faced the same problem. My solution:

  • I downgraded Firefox to 36.0.
  • It worked fine with Selenium 2.53.1.

I hope this help. :)

Tam Dao
  • 435
  • 4
  • 10
0

The problem here for me was, I was using firefox 46.0.1 for testing with latest version of selenium driver which of course worked fine with modern version of the firefox but acted weird with firefox 46.0.1.

To get it working, I had to downgrade the Selenium version to 2.53.0 from 4.4.0 and the respective dependent references should be brought down too.

Jamshaid K.
  • 3,555
  • 1
  • 27
  • 42