Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FirefoxDriver always starting on "firstrun" page, breaking all test scripts

Starting just last night, the FirefoxDriver has been always opening on this page: https://www.mozilla.org/en-US/firefox/42.0/firstrun/learnmore/. I have tried changing the default profile settings and have not had any success.

The following question, http://stackoverflow.com/questions/33937067/firefox-webdriver-opens-first-run-page-all-the-time, is similar, but I do not see where to implement the four lines of code, and my personal attempts of throwing it into my scripts have proved futile.

This problem started absolutely out of the blue last night. I have presentations to do today and I can't get any of my scripts to work.

Instantiating my WebDriver instance like so will cause a NoSuchMethodError:

                FirefoxProfile profile = new FirefoxProfile();
                profile.setPreference("browser.startup.homepage", "about:blank");
                profile.setPreference("startup.homepage_welcome_url", "about:blank");
                profile.setPreference("startup.homepage_welcome_url.additional", "about:blank");
                driver = new FirefoxDriver(profile);
                driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

But getting rid of profile in FirefoxDriver brings it back to the firstrun page mentioned above.

like image 714
jagdpanzer Avatar asked Dec 03 '15 15:12

jagdpanzer


3 Answers

I was having this problem when running RSpec/Capybara tests using a Selenium Webdriver and Poltergeist with Firefox as the browser for a Rails app. Tried reconfiguring Firefox in various ways to no avail but managed to fix by simply updating the selenium-webdriver gem in my Gemfile (gem 'selenium-webdriver'):

bundle update selenium-webdriver

Credit goes to @lucetzer

like image 105
Andy Gout Avatar answered Nov 15 '22 10:11

Andy Gout


I had the same problem with the first run page, after some searching I found that this worked for me (I use WebDriver 2.53.0 and FF 45.0.1):

FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("browser.startup.homepage_override.mstone", "ignore");
profile.setPreference("startup.homepage_welcome_url", "about:blank");
profile.setPreference("startup.homepage_welcome_url.additional","about:blank");
profile.setPreference("browser.startup.homepage","about:blank");
WebDriver driver = new FirefoxDriver(profile);
like image 31
narathos Avatar answered Nov 15 '22 10:11

narathos


Go to profile manager using "Firefox.exe - p"

You will have more than one profile. Please select default profile and make it default all time.

It should not open that page. i tested and it works fine.

You can try this code. I am pretty sure it will work.

    ProfilesIni profile = new ProfilesIni();
    FirefoxProfile ffprofile = profile.getProfile("default");
    WebDriver driver = new FirefoxDriver(ffprofile);
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
like image 26
N.. Avatar answered Nov 15 '22 11:11

N..