Srinivas,
   Here you have used Location instead of creation time ,why to complicate
things if there is simple solution
The same can be done using the previous code given by Dmitry

While Browser("Location:=0").Exist
  Browser("Location:=0").Close
Wend

Ordinal identifier is the method used by QTP to index object with similar
property,i have explained this at

http://testingideas.wordpress.com/2008/08/26/object-repository-and-descriptive-programming-in-qtp/
Regards,
Dhanasekar S.
http://testingideas.wordpress.com
---------------------------------------------------------
Let us make the World Greener
http://www.greenpeace.org/international/
-----------------------------------------------------------


2008/9/1 Srinivas Pavuluru <[EMAIL PROTECTED]>

> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to