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
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 |
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 |
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 |
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 |
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 |
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 |
How will internal and external links be validated and updated? how often?
What is diff betwee datatable.importsheet "path" and datatable.import
what are the 5 types of objects in qtp
suppose there r 10 action in a test i want to execute action 5 to 10 how would i do that
How to interact tool & application build in QTP?
WHAT IS THE DESCRIPTIVE programming when it is useful? & when to use this ?
How does qtp identify objects in the application?
actually how many hours per one day we will work on automation(qtp) in real time
if there r 10 windows open in QTP write a command to close all 10 windows at a time ?
hi guys, pls tell me for testing institution training hub, hitech city is best or not?
how to retrieve the xml file data through qtp. can anybody send script for this..
How to Test the mainframe application?(tell me few basic things)