【发布时间】:2015-07-09 17:41:30
【问题描述】:
我正在尝试在 IE 8 中执行测试用例。但有时我会收到 Windows Internet Explorer 安全警告“是否要为此页面启用安全内容”或模态对话框“停止运行此脚本...” .我如何在 selenium Webdriver 中处理它。任何帮助将不胜感激。
【问题讨论】:
我正在尝试在 IE 8 中执行测试用例。但有时我会收到 Windows Internet Explorer 安全警告“是否要为此页面启用安全内容”或模态对话框“停止运行此脚本...” .我如何在 selenium Webdriver 中处理它。任何帮助将不胜感激。
【问题讨论】:
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);
【讨论】: