如何通过 Watin 中的代码关闭弹出窗口阻止程序? [英] How to turn off popup blocker through code in Watin?

查看:26
本文介绍了如何通过 Watin 中的代码关闭弹出窗口阻止程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在通过 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.

推荐答案

您可以使用 .NET 更改 IE 的注册表项.请参阅 http://support.microsoft.com/kb/843016 了解有关特定键.

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.

全部:

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 能够下载文件:

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:

以编程方式将受信任的站点添加到 Internet Explorer

这篇关于如何通过 Watin 中的代码关闭弹出窗口阻止程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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