6

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.

jagdpanzer
  • 693
  • 2
  • 10
  • 35

4 Answers4

11

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

Andy Gout
  • 302
  • 2
  • 19
3

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);
narathos
  • 31
  • 2
2

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);
N..
  • 906
  • 7
  • 23
  • I am having the same problem as @jagdpanzer. I only have one default Firefox profile (having followed their guide: https://support.mozilla.org/en-US/kb/profile-manager-create-and-remove-firefox-profiles). Can you please specify where this code should be used and whether it is located in an existing file or a newly created one (in which instance should its name be something specific)? Thanks. – Andy Gout Dec 22 '15 at 23:20
  • default profile is always there. Most of time code is used to open Firefox at default profile setting and avoid all other extension load. – N.. Dec 23 '15 at 14:36
  • I have only one profile. But firstrun page stills open – Crusader Feb 11 '16 at 10:34
  • Did you create default profile and try to use that? – N.. Feb 11 '16 at 14:02
0

There is an issue with the certificates in the first run splash screen of the Mozilla homepage. I filed a ticket for this in Bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=1269500

To fix this issue in Selenium/Capybara/Cucumber, we need to change the default homepage for new profiles to blank or another page. To do so, register your firefox/selenium driver in the configuration:

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