【问题标题】:How to bypass the firefox update page when using Selenium?使用 Selenium 时如何绕过 firefox 更新页面?
【发布时间】:2016-03-05 09:13:02
【问题描述】:

我在 Firefox 浏览器上运行了一些 selenium 测试。 不幸的是,虽然我很小心地创建了一个新的配置文件,但当我开始测试时,我总是会显示 Firefox 的 /firstrun/ 页面,这很烦人,因为该页面会通过网络获取内容。

我已尝试通过以下方式禁用它

    FirefoxProfile profile = new FirefoxProfile(profileDir);
    if(!exists) {
        profile.setPreference("signed.applets.codebase_principal_support", true);
        profile.setPreference("capability.principal.codebase.p0.granted", true);
        profile.setPreference("startup.homepage_override_url", "about:blank");
        profile.setPreference("browser.startup.homepage_override.mstone", "'ignore'");

但它仍然出现。

如何确保 Firefox 启动时不显示页面?

【问题讨论】:

  • 为什么ignore 值用单引号括起来?我认为不应该。

标签: java firefox selenium junit


【解决方案1】:

Kiril 提出了正确的问题 - “为什么要使用单引号?”。没有它对我有用。

 profile.setPreference("browser.startup.homepage_override.mstone", "ignore");

另一种方法是在创建 Firefox 实例后加载空白页面 (driver.get("about:blank");)

【讨论】:

    猜你喜欢
    • 2016-07-10
    • 1970-01-01
    • 1970-01-01
    • 2021-09-18
    • 2022-09-27
    • 1970-01-01
    • 2021-03-22
    • 1970-01-01
    • 2014-04-17
    相关资源
    最近更新 更多