从昨晚开始,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);
Run Code Online (Sandbox Code Playgroud)
但摆脱profile在FirefoxDriver把它带回上面提到的firstrun页面.
And*_*out 11
当使用Selenium Webdriver和Poltergeist以及Firefox作为Rails应用程序的浏览器运行RSpec/Capybara测试时,我遇到了这个问题.尝试以各种方式重新配置Firefox无济于事,但通过简单地更新我的Gemfile(gem 'selenium-webdriver')中的selenium-webdriver gem来设法修复:
bundle update selenium-webdriver
归功于@lucetzer
使用“Firefox.exe - p”转到配置文件管理器
您将拥有不止一份个人资料。请选择默认配置文件并使其始终默认。
它不应该打开该页面。我测试过,效果很好。
你可以试试这个代码。我很确定它会起作用。
ProfilesIni profile = new ProfilesIni();
FirefoxProfile ffprofile = profile.getProfile("default");
WebDriver driver = new FirefoxDriver(ffprofile);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7541 次 |
| 最近记录: |