【问题标题】:Windows Internet Explorer Modal dialog box preventing selenium test run阻止 selenium 测试运行的 Windows Internet Explorer 模式对话框
【发布时间】:2015-07-09 17:41:30
【问题描述】:

我正在尝试在 IE 8 中执行测试用例。但有时我会收到 Windows Internet Explorer 安全警告“是否要为此页面启用安全内容”或模态对话框“停止运行此脚本...” .我如何在 selenium Webdriver 中处理它。任何帮助将不胜感激。

【问题讨论】:

    标签: selenium webdriver


    【解决方案1】:

    InternetExplorerOptions 中有一个选项可以让您在出现意外时自动关闭模式。 这就是我在 C# 中的处理方式,这在 Java 或其他绑定中也应该非常相似。

    var options = new InternetExplorerOptions { EnableNativeEvents = false };
    options.EnsureCleanSession = true;
    //This is the main hook
    options.AddAdditionalCapability("disable-popup-blocking", true);
    Driver = new InternetExplorerDriver(options);
    

    【讨论】:

    • 谢谢赛弗。我无法在 IE 8 中解决这个问题。但幸运的是,我的公司停止支持 IE 8 :)
    猜你喜欢
    • 1970-01-01
    • 2013-08-30
    • 2020-06-09
    • 1970-01-01
    • 2017-09-14
    • 1970-01-01
    • 2015-03-11
    • 2017-03-20
    • 1970-01-01
    相关资源
    最近更新 更多