如何通过 Watin 中的代码关闭弹出窗口拦截器?

发布于 2024-07-21 15:52:46 字数 140 浏览 13 评论 0原文

我在通过 watin 代码关闭弹出窗口阻止程序时遇到麻烦。 谁能帮我知道如何通过 watin 关闭 IE 的弹出窗口拦截器? 如果 IE 中安装了工具栏(如 google、yahoo 或 msn)的弹出窗口拦截器,有什么方法可以关闭它们吗? 提前感谢您的帮助。

I am facing trouble in turning the popup blocker off through watin code. Could anyone please help me in knowing how to turn off the popup blocker of IE through watin? Is there any way to turn off the popup blocker of tool bars (like google, yahoo or msn) if any of them are installed in IE? Thanks for your help in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

鱼忆七猫命九 2024-07-28 15:52:47

您可以使用 .NET 更改 IE 的注册表项。 有关特定的详细信息,请参阅 http://support.microsoft.com/kb/843016键。

全部:

HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_WEBOC_POPUPMANAGEMENT
Value = 0 for Off
Value = 1 for On

每个区域:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\[0-4]\1809
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\[0-4]\1809
Value = 0 for Enabled
Value = 3 for Disabled

每个站点:

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\New Windows\Allow
Create subkey with domain name and binary data.

下面是通过 .NET 编写注册表项以将站点置于受信任区域的代码示例,这使得 WatiN 能够下载文件:

以编程方式将可信站点添加到 Internet Explorer

You can use .NET to change the registry keys for IE. See http://support.microsoft.com/kb/843016 for more information on the specific keys.

All:

HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_WEBOC_POPUPMANAGEMENT
Value = 0 for Off
Value = 1 for On

Per Zone:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\[0-4]\1809
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\[0-4]\1809
Value = 0 for Enabled
Value = 3 for Disabled

Per Site:

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\New Windows\Allow
Create subkey with domain name and binary data.

Here is a code example of writing the registry keys through .NET to get a site into a trusted zone, which allowed WatiN to be able to download a file:

Programmatically add trusted sites to Internet Explorer

怪我太投入 2024-07-28 15:52:47

您无法使用 WatiN 禁用此功能,但是您可以使用 UIAutomation 来执行此操作。

You can't disable this with WatiN, you could however use UIAutomation to do it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文