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

What is the syntax to call one action in another?

0 Answers  


can u expect, major bugs in NET BANKING Project? Modules Transaction Module, Customer Relation Module.

2 Answers  


For QTP Test Engineer, What is his contribution to the Project? Means, As as automation test engineer what is his role in the current project?

0 Answers   V2 Solutions,


How do Parameterization and Data-Driving relate to each other in QTP?

0 Answers  


what is test scheduleling?

0 Answers   IBM,






What is the use of "Step Generator" in QTP??for what purpose we are using??explain with an example

2 Answers  


what is the difference between an Action and a function in real time

4 Answers  


How to export(copy) the entire webtable from the webpage into Excelsheet? using Vb scripting

9 Answers  


We have 10 rows of records in data table, but we have to run 4th, 5th and 6th rows only. How can we handle this scenario in QTP?

5 Answers   Accenture, Banca Sella, Polaris,


can anyone tell me how to search a word/line in a document and to paste it in another file? Thanks in advance.

4 Answers  


What are the types of object repository in qtp?

0 Answers  


Can anyone tell me what is the equivalant method to be used in QTP for "web_obj_get_text" used in winrunner. My winrunner code is below. set_window("Confirm Add Subscriber"); rc = web_obj_get_text("Add subscriber:","#8","#1",orderID,"The order number is","\.",1); basically I need to retrieved the "orderID " from a string present in 8th row & 1st col of table "Add subscriber"

1 Answers  


Categories