Tutorial :IE Popup is blocked in WATIN (Help Required)



Question:

I have a page in which i have a link button.When i click on the link button a popup will appear,but the same if i do through "watin" , the popup is blocked and is showing the message "popup is blocked.Press "Ctrl" key to to allow the popup" is coming.

Through watin automation i am not able to get the pop up on click of a link button but if i click manually the popup is coming.I am sick and tired of searching for solution :( could anyone please help me.

Code is given below

Link link = myIE.Span(Find.ByText("hello"));
link.Click(); //here the popup is not coming

Thanks, Keshav


Solution:1

Presumably you have disabled the built-in IE pop-up blocker, which is why it's working manually...

Do you have any other IE toolbars installed, such as Google, Yahoo or MSN? Toolbars and other mystery pop-up blockers have been known to do this with Watin.


Solution:2

You can use .NET to change the registry keys for IE.

Enable or disable all browser extensions:

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main]    Set value of [Enable Browser Extensions] to "Yes" or "No"  

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


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »