Suppose there are 10 browsers opened on desktop. I want to
close all browsers except one browser in QTP. Can any one
give the code for this?
Answers were Sorted based on User's Feedback
Answer / sharath
you can use descriptives programming concepts.
"CreationTime" is a QTP browser property, which indicates
the order in which browsers were opened.
To close 1st browser --> Browser("CreationTime:=0").Close
2nd browser --> Browser("CreationTime:=1").Close.
you can use a loop to close other 9 browsers..
Is This Answer Correct ? | 17 Yes | 3 No |
Answer / nihar ranjan sethy
set odesc=description.create
odesc("micclass").value="browser"
set x=desktop.childobjects(odesc)
for i=10 to 2 step-1
x(i).close
next
Is This Answer Correct ? | 4 Yes | 0 No |
Answer / rico
just made a small correction. Here goes the updated answer
Set browserDesc = Description.Create()
browserDesc(”application version”).Value = “internet
explorer 6"
Set Allbrowsers = DeskTop.ChildObjects(browserDesc)
BrowserCnt = Allbrowsers.Count
For i = 0 To (browserCnt -2)
Allbrowsers(i).Close
Next
Set browserColl = Nothing
Set browserDesc = Nothing
Is This Answer Correct ? | 7 Yes | 7 No |
Answer / sireesha
If you want to close all browsers except gmail browser then you will follow this code.
set ObjDesk = Description.Creation
ObjDesk("micclass").Value="Browser"
set ObjDec =Desktop.ChildObjects(ObjDesk)
BroCount=ObjDec.Count
msgbox BroCount
if BroCount >0 then
for i=BroCount-1 to 0 step-1
if Instr(1,Browser("CreationTime=&i").GetRoproperty("name"),"gmail")=0 then
Browser("CreationTime:=&i").Close
End If
Next
End If
Is This Answer Correct ? | 2 Yes | 2 No |
Answer / vijay
While Browser("creationtime=0").exist(0)
Browser("creationtime=0").close
wend
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / shankar
set brow=description.create
brow("micclass").value="browser"
set brows=Desctop.childobjects(brow)
for i=0 to brows.counts-1
browser(brow).close
please reffer this and if it is wrong give me clarification.
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / rico
Assuming all 10 browsers are IE6
Set browserDesc = Description.Create()
browserDesc(”application version”).Value = “internet
explorer 6″
Set Allbrowsers = DeskTop.ChildObjects(browserDesc)
BrowserCnt = Allbrowsers.Count
For i = 0 To (browserCnt -2)
Allbrowsers(i).Close
Next
Set browserColl = Nothing
Set browserDesc = Nothing
Is This Answer Correct ? | 4 Yes | 8 No |
VB - Script Training in MUMBAI.
I have written a code to fetch values fro access db and place in the fields. Iam using GetROProperty to fetch runtime values. Now i want to add runtime values to the access db in field v3. please help me. Its not writting in the db. Option explicit Dim con,rs,db,c Set con=createobject("adodb.connection") Set rs=createobject("adodb.recordset") con.Open "Driver={Microsoft Access Driver (*.mdb)};dbq=D:\Sales.mdb" rs.open "select * from tax",con Do while not rs.eof Browser("Sales Tax Calculator").Page("Sales Tax Calculator").WebEdit("incost").Set rs.fields("v1") Browser("Sales Tax Calculator").Page("Sales Tax Calculator").WebEdit("intax").Set rs.fields("v2") c=Browser("Sales Tax Calculator").Page("Sales Tax Calculator").WebEdit("outtax").GetROProperty("value") rs.MoveNext print c Loop Do while not rs.EOF rs.EditMode rs.Fields("v3").Value="3" rs.Update rs.MoveNext Loop Set rs=nothing Set con=nothing
hi friends i was tried to connect qtp with oracle database using provider.i got a error.so anyone can help me out by correct script
HOW to invoke any recorded script in QTP with out using RECORD & PLAYBACK CONCEPT?
Add parameters during time in each row in one column
what are the design objects in qtp
How do you send email with attachment from outlook using qtp ?
What is Object Spy?
Hi,Every one,my name is RAHUL,aim wondering if any one got QTP software? If yes,can u plz knock on to gchinthakindhi@gmail/yahoo.com. THANK U.
Hi, I got error message as "object does not support this property or method: "Test.Actions" when i execute the following line of script on QTP 9.0 Dim qtApp, qtRep Set qtApp = CreateObject("QuickTest.Application") Set qtRep = qtApp.Test.Actions("Action1").ObjectRepositories Can anyone tell me where i am wrong.
How do you handle multiple banners(at the top the page, the banner is scrolling) in a web page(Dont take the name property(regular expression))
How do you know the location Id of an object if you know its index id?