How to turn off popup blocker through code in Watin?

后端 未结 2 1707
暖寄归人
暖寄归人 2021-01-16 12:01

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 the

2条回答
  •  借酒劲吻你
    2021-01-16 12:45

    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

提交回复
热议问题