FirefoxDriver always starting on “firstrun” page, breaking all test scripts

后端 未结 4 1747
说谎
说谎 2021-01-02 23:08

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 c

相关标签:
4条回答
  • 2021-01-02 23:29

    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

    0 讨论(0)
  • 2021-01-02 23:36

    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);
    
    0 讨论(0)
  • 2021-01-02 23:46

    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);
    
    0 讨论(0)
  • 2021-01-02 23:52

    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
    
    0 讨论(0)
提交回复
热议问题