write a script to close all open browser in qtp except one
browser whose name is xyz

Answers were Sorted based on User's Feedback



write a script to close all open browser in qtp except one browser whose name is xyz..

Answer / gangadhar

set objbrowser=Description.Create
objbrowser("micclass").value="Browser"
set a=Desktop.ChildObjects(objbrowser)
msgbox a.count
for i=o to a.count-1
s=a(i).GetRoProperty("Title")
If instr(s,"Gmail")=0 Then
a(i).close
End If
Next

Is This Answer Correct ?    9 Yes 1 No

write a script to close all open browser in qtp except one browser whose name is xyz..

Answer / milan das

Set objbrowser=description.Create
objbrowser("micClass").value="Browser"

Set objbrwcnt=Desktop.ChildObjects(objbrowser)

msgbox objbrwcnt.count

For i=0 to objbrwcnt.count -1

If objbrwcnt(i).GetRoProperty("name")<>"xyz" Then

objbrwcnt(i).close

End If

Next

Is This Answer Correct ?    5 Yes 1 No

write a script to close all open browser in qtp except one browser whose name is xyz..

Answer / guest

Set odesc=Description.Create
odesc("micclass").Value="Browser"
Set a=Desktop.ChildObjects(odesc)
For i = 0 To a.count-1
t=a(i).GetRoProperty("Title")
print t
If Trim(t)<>"xyz" Then
a(i).Close
End If
Next

--Ganesh

Is This Answer Correct ?    1 Yes 0 No

write a script to close all open browser in qtp except one browser whose name is xyz..

Answer / pravati

set obj=Description.create()
obj("micclass").value="Browser"
set brsrobj=Desktop.childobjects(obj)
msgbox brsrobj.count
for i=0 to brsrobj.count -1
x=Browser("micclass:=Browser","creationTime:=&i-1").Getroproperty("name")
if instr(x,"xyz')=0 Then
Browser("micclass:=Browser","creationTime:=&i-1").close

Is This Answer Correct ?    1 Yes 0 No

write a script to close all open browser in qtp except one browser whose name is xyz..

Answer / lak

dim oBrowser,oAllBrowser,nProcessId,nCounter

set oBrowser = Description.Create
oBrowser("micclass").vlaue="Browser"

set oAllBrowser = Desktop.childObjects(oBrowser)

for nCounter=0 to oAllBrowser.count-1

if(instr(oAllBrowser(nCounter).getRoProperty
("title"),"xyz"))<=0 then
nProcessId = oAllBrowser(nCounter).getRoProperty("process
id")
Systemutil.closeProcessById nProcessId
End if
else
oAllBrowser(nCounter).close

Is This Answer Correct ?    0 Yes 0 No

write a script to close all open browser in qtp except one browser whose name is xyz..

Answer / manjunathareddy

Dim iIndex
iIndex=0
While Browser("CreationTime:="&iIndex).Exist(1)
Title=Browser("CreationTime:="&iIndex).GetRoProperty("title")
If InStr(Title,"xyz")=0 Then
Browser("CreationTime:="&iIndex).Close
If iIndex<>0 Then
iIndex=iIndex - 1
End If
Else
iIndex=iIndex+1
End If
Wend

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More QTP Interview Questions

How will internal and external links be validated and updated? how often?

0 Answers  


What is diff betwee datatable.importsheet "path" and datatable.import

2 Answers  


what are the 5 types of objects in qtp

6 Answers   ABC, TCS, Wipro,


suppose there r 10 action in a test i want to execute action 5 to 10 how would i do that

2 Answers  


How to interact tool & application build in QTP?

0 Answers  


WHAT IS THE DESCRIPTIVE programming when it is useful? & when to use this ?

6 Answers   CTS,


How does qtp identify objects in the application?

0 Answers  


actually how many hours per one day we will work on automation(qtp) in real time

1 Answers   Synechron,


if there r 10 windows open in QTP write a command to close all 10 windows at a time ?

11 Answers   Wipro,


hi guys, pls tell me for testing institution training hub, hitech city is best or not?

0 Answers  


how to retrieve the xml file data through qtp. can anybody send script for this..

3 Answers   Synechron,


How to Test the mainframe application?(tell me few basic things)

1 Answers   Covansys, IBM, UST,


Categories