【问题标题】:How do I handle allow pop-up of plug-in for firefox using Selenium Webdriver with Java如何使用 Selenium Webdriver 和 Java 处理允许弹出插件的 firefox
【发布时间】:2016-12-14 15:24:47
【问题描述】:

同时自动化包含 Vidyo Web 播放器插件的网页。 如果我正在导航到视频页面,则会显示允许弹出窗口。 我试图用下面的代码来处理允许弹出。但它不起作用。

下面是正在使用的代码,

FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("security.mixed_content.block_active_content", true);
profile.setPreference("security.mixed_content.block_display_content", false);
WebDriver driver = new FirefoxDriver(profile);

有人可以帮忙吗?

提前致谢。

【问题讨论】:

  • 您想隐藏这个弹出窗口还是允许自动使用插件或其他方式?

标签: java selenium


【解决方案1】:

参考this 答案,您可能需要为扩展名获取文件并使用以下内容:

File file = new File("path to extension file");    
FirefoxProfile profile = new FirefoxProfile();
profile.addExtension(file);
WebDriver driver = new FirefoxDriver(profile);

【讨论】:

    【解决方案2】:

    这个偏好怎么样:

    FirefoxProfile profile= new FirefoxProfile();
    profile.setPreference(“browser.popups.showPopupBlocker”, false);
    WebDriver driver = new FirefoxDriver(profile);
    

    【讨论】:

      【解决方案3】:

      尝试设置此首选项以摆脱“允许”/“继续阻止”:

      profile.setPreference("plugin.scan.plid.all", false);
      

      您可能还需要使用它来自动允许扩展

      profile.setPreference("extensions.blocklist.enabled", false);
      

      【讨论】:

        猜你喜欢
        • 2015-06-29
        • 2013-10-24
        • 1970-01-01
        • 2015-07-09
        • 2011-11-13
        • 2020-03-16
        • 1970-01-01
        • 2017-11-24
        • 2014-08-09
        相关资源
        最近更新 更多