Quick test professional

QTP Tips QTP codes QTP Faqs and more

Close Opened Browsers Except QC

Dim intIndex
Set oDesc=Description.Create
oDesc(“micclass”).Value=”Browser”
intIndex=0
While Browser(“micclass:=Browser”,”index:=”&intIndex).exist(0) and intIndex<Desktop.ChildObjects(oDesc).count
If instr(1, Browser("micclass:=Browser","index:="&intIndex).getRoProperty("name"),"Quality Center") = 0 Then
SystemUtil.CloseProcessByHwnd( Browser("micclass:=Browser","index:="&intIndex).getRoProperty("hwnd"))
else
intIndex=intIndex+1
End if
wend

Advertisements

March 17, 2011 Posted by | Browser Scripts, Descriptive programming, Descriptive Programming and Child Objetcs | 7 Comments

GET NAMES OF ALL OPEN BROWSERS

Set bDesc = Description.Create()

bDesc(“application version”).Value = “internet explorer 6”

Set bColl = DeskTop.ChildObjects(bDesc)

Cnt = bColl.Count

MsgBox “There are total: “&Cnt&”browsers opened”

 For i = 0 To (Cnt -1)

MsgBox “Browser : “&i&” has title: “& bColl(i).GetROProperty(“title”)

Next ‘ i

 Set bColl = Nothing

Set bDesc = Nothing

Author: Mohan Kakarla

February 14, 2008 Posted by | Browser Scripts | , , , , , , , , | 3 Comments