【发布时间】:2015-03-27 17:40:21
【问题描述】:
我知道这可以通过转到工具>Internet 选项>隐私并取消选中打开弹出窗口阻止程序手动完成一次。问题是如果我在另一台机器上运行这些测试,与弹出窗口相关的测试将失败。有没有办法使用Options 或DesireCapabilities for Internet Explorer 来完成此操作。我已经尝试过选项
var options = new InternetExplorerOptions { EnableNativeEvents = false };
options.EnsureCleanSession = true;
options.UnexpectedAlertBehavior = InternetExplorerUnexpectedAlertBehavior.Dismiss;
我试过了
InternetExplorerUnexpectedAlertBehavior.Accept;
但是,没有用。仍然阻止弹出窗口
【问题讨论】:
-
你可以试试这个...
ieCapabilities.setCapability("disable-popup-blocking", true);...它的java... -
对于类似的要求,我以编程方式在从机中更新注册表 - HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\New Windows ; PopupMgr 应该是 0
-
@VivekSingh 抱歉没用
-
@VinothS 谢谢。我实际上对以编程方式禁用更感兴趣
-
@Saifur ,实际上 Vinoth 试图说您可以在测试初始化方法中以编程方式(使用 c#)更新注册表。
标签: c# internet-explorer selenium selenium-webdriver webdriver