FirefoxDriver始终在“启动”;“第一次运行”;第页,断开所有测试脚本

FirefoxDriver始终在“启动”;“第一次运行”;第页,断开所有测试脚本,firefox,selenium,Firefox,Selenium,从昨晚开始,FirefoxDriver一直在打开此页面:https://www.mozilla.org/en-US/firefox/42.0/firstrun/learnmore/。我尝试过更改默认配置文件设置,但没有成功 下面的问题,http://stackoverflow.com/questions/33937067/firefox-webdriver-opens-first-run-page-all-the-time,与之类似,但我不知道在哪里实现这四行代码,我个人尝试将其放入脚本中,结果

从昨晚开始,FirefoxDriver一直在打开此页面:
https://www.mozilla.org/en-US/firefox/42.0/firstrun/learnmore/
。我尝试过更改默认配置文件设置,但没有成功

下面的问题,
http://stackoverflow.com/questions/33937067/firefox-webdriver-opens-first-run-page-all-the-time
,与之类似,但我不知道在哪里实现这四行代码,我个人尝试将其放入脚本中,结果证明是徒劳的

这个问题是昨晚突然发生的。我今天有演讲要做,我的任何脚本都无法运行

像这样实例化我的WebDriver实例将导致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);

但是在
FirefoxDriver
中删除
profile
会使其返回到上面提到的第一个运行页面。

使用“Firefox.exe-p”转到profile manager

您将拥有多个配置文件。请选择默认配置文件并使其始终处于默认状态

它不应该打开那个页面。我做了测试,效果很好

你可以试试这个代码。我很肯定它会起作用的

    ProfilesIni profile = new ProfilesIni();
    FirefoxProfile ffprofile = profile.getProfile("default");
    WebDriver driver = new FirefoxDriver(ffprofile);
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

我在运行RSpec/Capybara测试时遇到了这个问题,该测试使用SeleniumWebDriver和Poltergeist,Firefox作为Rails应用程序的浏览器。尝试以各种方式重新配置Firefox,但无效,但通过简单地更新我的Gemfile中的selenium webdriver gem(
gem'selenium webdriver'
)成功修复了此问题:

捆绑更新selenium webdriver


归功于@lucetzer

我在第一次运行页面时也遇到了同样的问题,经过一些搜索后,我发现这对我来说很有效(我使用WebDriver 2.53.0和FF 45.0.1):


Mozilla主页的首次运行启动屏幕中的证书存在问题。我在Bugzilla申请了一张罚单:

要在Selenium/Capybara/Cucumber中解决此问题,我们需要将新配置文件的默认主页更改为空白或其他页面。为此,请在配置中注册firefox/selenium驱动程序:

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

我和@jagdpanzer有同样的问题。我只有一个默认的Firefox配置文件(遵循了他们的指南:)。您能否指定此代码应在何处使用,以及它是位于现有文件还是新创建的文件中(在哪种情况下,其名称应是特定的)?谢谢。默认配置文件始终存在。大多数情况下,代码用于在默认配置文件设置下打开Firefox并避免所有其他扩展加载。我只有一个配置文件。但firstrun页面仍然打开您是否创建了默认配置文件并尝试使用它?
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