【发布时间】:2016-03-08 06:10:50
【问题描述】:
从昨晚开始,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 会将它带回到上面提到的第一个运行页面。
【问题讨论】: