How to turn off popup blocker through code in Watin?

为君一笑 提交于 2019-12-01 11:58:49

问题


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.


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/934064/how-to-turn-off-popup-blocker-through-code-in-watin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!