我正在尝试在IE 8中执行测试用例。但有时我会收到Windows Internet Explorer安全警告"您是否要为此页面启用安全内容"或模态对话框"停止运行此脚本..."。我如何在selenium Webdriver中处理它。任何帮助将不胜感激。
答案 0 :(得分: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);