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

we have one text box and one list box(list box appear in same page or another page) what ever the text enter in text box that must be displyed in list box as first one. for example if we enter 10 in text box that is the 1st item in list box . after that we enter 11 then 11 is the 1st item and 10 is 2nd item. the maximum limit of list box is 10 items. if we enter 11th item the 10th item is deleted and llth one is add as 1st one and 9th one goes to 10th position

3 Answers   Covansys,


1.How to record ,capture and also script to capture the close buttons. 2.How to record ,capture and also script to capture the options ---File ->save and File ->close in a browser and PDF files. 3.How to compare the Excel sheet values in a report using QTP scripting. 4.How to compare 2 PDf reports using QTP scripts as well reording. 5.How to compare 2 Excel reports using QTP scripts as well reording. 6.How to save a PDF report to a folder and then translate the report to an Excel type of report and compare that Excel Report with an other excel report. Please clarify me

0 Answers  


How to execute a WinRunner Script in QTP?

1 Answers   Crea,


How to export data present in Datatable to an ".xls" file?

2 Answers  


We have a text file which contains 1 to 100 numeric values sequentially like 1 2 . . 100 Now we have to count them and transfer to XML file by writing a code in qtp.

1 Answers   Cap Gemini,






how to identify a webtable coulmn values ,if we spy the coulmn value it is sometimes identifying as Webedit and some times it is identifying as "webelement", Could any body let me know how to handle the issue?

1 Answers  


Can testing be done on the production system, or will a separate test system be required? How are browser caching, variations in browser option settings, dial-up connection variabilities, and real-world internet 'traffic congestion' problems to be accounted for in testing?

0 Answers  


3.How to record a word doc using qtp i.e open a word doc,type something and save the doc can someone send me the code.

5 Answers  


What is the syntax to call one action in another?

0 Answers  


Once we get the Test Result from QTP.,I Have to convert into Excel file format..Is it possible..Can any gudie me regarding this... For Example : Total Test Case is : XXXXX Test Case passed : XXX Test Case Failed : XXX -------- Total XXXXXX ---------

6 Answers  


HOW to invoke any recorded script in QTP with out using RECORD & PLAYBACK CONCEPT?

1 Answers  


Thanks....But can u tell me how i use the QTP for GIS with one Example...

0 Answers  


Categories