use the following function for close all browsers.. instead of creation
time.
Creation time is the one QTP to identify browser opened sequence.. Which is
not displayed in properties.. If you record your script on more than one
opened browser of similar names, you will see creation time property, by
right clicking and viewing on recorded script browser objects. Following
function i found from QTP resources. you can use it by calling function
name within your script.
*Public function close_all_browsers()
dim bcount, bcount2
if(Browser("micclass:=Browser").exist) then
Browser("micclass:=Browser").close
end if
wait(2) 'wait for closing browsers to close
bcount = 0
while (Browser("micclass:=Browser","location:=" & bcount).exist)
bcount=bcount+1
wend
if (bcount>1) then
'msgbox "Warning: " & bcount & " browser windows found"
end if
for bcount2 = 0 to bcount -1
Browser("micclass:=Browser","location:=0").close
next
end function
*
Thanks & Regards
Srinivas P
On 8/31/08, Ashwini Khanna <[EMAIL PROTECTED]> wrote:
>
>
> Hey Dmitry,
>
> I found this code on your blog-site to close all browsers.
>
> ----------------------------------------------------------------
>
> While Browser("CreationTime:=0").Exist
> Browser("CreationTime:=0").Close
> Wend
> ----------------------------------------------------------------
>
> This code works well and closes all instances of IE. But what question
> arises in my mind is - when I SPY on IE Browser I can't see any property
> called "CreationTime"; so how does it work?
>
> Regards,
> Ashwini
>
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "QTP
- HP Quick Test Professional - Automated Software Testing" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en
-~----------~----~----~----~------~----~------~--~---