禁用IE通过选项类或DesiredCapabilities弹出窗口阻止程序 [英] Disable IE pop up blocker through Options class or DesiredCapabilities

查看:282
本文介绍了禁用IE通过选项类或DesiredCapabilities弹出窗口阻止程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这可以通过以下的工具> Internet选项>隐私的和取消选中的打开弹出窗口阻止程序即可。现在的问题是,如果我运行在不同的机器上的这些测试,弹出窗口将失败相关的测试。有没有办法做到这一点使用选项 DesireCapabilities 互联网浏览器。我曾与选项尝试

I know this can be done manually once by going to Tools>Internet Options>Privacy and unchecking Turn on Pop-up Blocker. The problem is if I run these tests on a different machine the tests related to pop up window will fail. Is there a way to accomplish this using Options or DesireCapabilities for Internet Explorer. I have tried with options

var options = new InternetExplorerOptions { EnableNativeEvents = false };
options.EnsureCleanSession = true;
options.UnexpectedAlertBehavior = InternetExplorerUnexpectedAlertBehavior.Dismiss;



我曾尝试

I have tried

InternetExplorerUnexpectedAlertBehavior.Accept;



但是,没有工作。尽管如此块弹出

But, did not work. Still blocks the pop up

推荐答案

导入此 - 的Microsoft.Win32

Import this - Microsoft.Win32

RegistryKey regKey = default(RegistryKey);
regKey = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Internet Explorer\\New Windows", true);
regKey.SetValue("PopupMgr", 0);
regKey.Close();

这篇关于禁用IE通过选项类或DesiredCapabilities弹出窗口阻止程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆