Firefox webdriver opens first run page all the time
Asked Answered
V

9

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.

Vermifuge answered 26/11, 2015 at 11:8 Comment(0)
C
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.

Clothe answered 5/1, 2016 at 22:4 Comment(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)Addendum
O
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");
Oakleil answered 26/11, 2015 at 13:7 Comment(5)
Where in our scripts would we put this?Elecampane
It seems to be a Java solution. What about a Python/Django solution?Slug
Pretty much the same, except use set_preference() in Python: selenium-python.readthedocs.org/…Kwei
Echoing @Elecampane - where do we put this? It's not a particularly helpful answer given the code presumably has to be somewhere very specific.Abwatt
The last line of your code is enough. The other options are already set by the webdriver (at least in 2.48).Clothe
O
9

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

Orvie answered 30/12, 2015 at 11:33 Comment(4)
Accusing him for anything is not nice also... .Freudberg
I'm not sure the difference Elmue, but upgrading to 2.48.1 fixed it for me as well.Radiography
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.Clobber
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.Franci
C
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>
Clobber answered 9/2, 2016 at 17:22 Comment(7)
Thanks, I appreciate your answer!Vermifuge
This solved it for me by going back two versions. URL for downloads: ftp.mozilla.org/pub/firefox/releasesMalignant
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"Howitzer
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.Clobber
@Clobber sure.. that may be true. but your post still doesn't actually answer the question in any way.Howitzer
@Clobber rather than guessing about compatibility, you could just read the release notes where any known compatibility issues are disclosed.Howitzer
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.Clobber
M
3

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

Mammilla answered 25/1, 2016 at 18:38 Comment(0)
C
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);  
Chrome answered 23/1, 2016 at 16:16 Comment(0)
H
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
Heeheebiejeebies answered 3/5, 2016 at 15:25 Comment(0)
I
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. :)

Intercostal answered 14/8, 2016 at 7:24 Comment(0)
K
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.

Kass answered 31/8, 2022 at 13:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.