How to work with Pop Up in IE with QTP

While doing automation testing , I have seen there are cases where there is requirement to check if a certain POP UP is coming or not. Generally those commercial websites which throws a lot of POP up during navigation needs such testing.

Again the traditional websites do not like the POP Up to be flashed during navigation.
So, we, the automation Test Engineers need to have a set of code which will set-reset this POP up functionality of IE.

The code to work with POP UP is below written:
'to disable pop up blocker
Call Popup_switch("no")
'to enable pop up blocker
Call Popup_switch("yes")

Function Popup_switch(param1)
Set WshShell=CreateObject("")
'the below line is to work with Registry
editregpath="HKCU\Software\Microsoft\Internet Explorer\New Windows\PopupMgr"
'to disable pop up blocker
if param1="no" then
WshShell.RegWrite editregpath,"no","REG_SZ"
 'to enable pop up blocker
elseif param1="yes" then
 WshShell.RegWrite editregpath,"yes","REG_SZ"
end if
End Function
How to work with Pop Up in IE with QTP How to work with Pop Up in IE with QTP Reviewed by Animesh Chatterjee on October 15, 2009 Rating: 5

No comments:

Powered by Blogger.