【问题标题】:Selenium - Block popup using firefox driverSelenium - 使用 Firefox 驱动程序阻止弹出窗口
【发布时间】:2013-05-17 10:40:18
【问题描述】:

我想使用 firefox 驱动程序阻止 selenium 中的弹出窗口。

有人做过这样的事吗?我曾尝试加载扩展,但没有成功。

有人可以帮忙吗?

谢谢!

问候, 卡尔佩什帕特尔

【问题讨论】:

    标签: selenium popup block selenium-firefoxdriver


    【解决方案1】:

    您需要使用您的浏览器配置文件并在那里阻止弹出窗口。在创建浏览器实例时将您的个人资料作为参数传递。检查下面的代码:

    ProfilesIni allProfiles = new ProfilesIni();
    FirefoxProfile profile = allProfiles.getProfile("Your-profile-name");
    profile.setPreference( "intl.accept_languages", "no,en-us,en" ); 
    FirefoxDriver driver = new FirefoxDriver(profile);
    driver.get("http://www.example.com/");
    

    注意:我认为您已经知道浏览器中配置文件的概念。

    【讨论】:

    • 是的,我知道。我之前也尝试过使用我的个人资料,但没有阻止弹出窗口。 :(我会再试一次,看看它是否有效。谢谢
    • 什么属性会阻止弹出窗口?
    猜你喜欢
    • 2014-01-08
    • 2015-06-23
    • 2018-07-15
    • 1970-01-01
    • 2016-05-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多