If there are some browsers opened and I don't how many browsers are open, Now I want to close all the browsers that I don't know how many are opened.
What would be Descriptive programming for this in QTP using VB Script..???
Please send your answers.

Answers were Sorted based on User's Feedback



If there are some browsers opened and I don't how many browsers are open, Now I want to close a..

Answer / m.ganesh

Set odesc=description.Create
odesc("micclass").value="Browser"
Set a=Desktop.ChildObjects(odesc)
print a.count
For i = 0 To a.count-1
browsername= a(i).getroproperty("name")
print browsername
Next

Is This Answer Correct ?    10 Yes 1 No

If there are some browsers opened and I don't how many browsers are open, Now I want to close a..

Answer / mogal

Set odesc=description.Create
odesc("micclass").value="Browser"
Set BrowCol=Desktop.ChildObjects(odesc)
For i = 0 To BrowCol.Count-1
BrowCol(i).Close
Next

Is This Answer Correct ?    3 Yes 0 No

If there are some browsers opened and I don't how many browsers are open, Now I want to close a..

Answer / dinesh1433

systemutil.CloseProcessbyName("iexplore.exe"

Is This Answer Correct ?    1 Yes 0 No

If there are some browsers opened and I don't how many browsers are open, Now I want to close a..

Answer / rangalnrt

set Objects = description.create
Objects("micclass").value = "Browser"

set Childs = Desktop.childobjects(Objects)

for i=0 to Childs.count-1 step 1

Browser("index:="&i).close

next

if Browser("index:=0").exist then

msgbox "Fail"

Else

msgbox "Pass"

End if

Is This Answer Correct ?    1 Yes 0 No

If there are some browsers opened and I don't how many browsers are open, Now I want to close a..

Answer / mogal

While Browser("creationtime:=0").Exist(0)

Browser("creationtime:=0").Close

Wend

Is This Answer Correct ?    1 Yes 0 No

If there are some browsers opened and I don't how many browsers are open, Now I want to close a..

Answer / kaps

'Check if this is working
Dim TrueOrFalse

Do while("True")
  TrueOrFalse = Browser("index:=0").Exist(2)
  if(TrueOrFalse = "False") then  
   exit do
  else
   Browser("index:=0").close    
  end if
Loop

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More QTP Interview Questions

i need to add 1000 users in a domain i written the script for that and it is running successfuly but the problem is that my system is not the user of that domain in which i have to add users so for adding users in that domain i have to install qtp on that another system, can anybody suggest me the way to add those users from my system ultimately i want to know how to access remote computer through script

0 Answers  


Is it possible to merge two object repository files in qtp?

0 Answers  


explain keyword driven framework?

2 Answers   Mindlance,


what we do after completion of functional and regression testing

2 Answers  


what is the difference between data driver & data driven and driver script?

0 Answers  






I have a string "Redfort is in Delhi" how do u write vbscript for " Delhi in is Redfort"

4 Answers  


how do pass parameters from one action to another action

2 Answers  


What’s the QTP testing process?

1 Answers  


How to invoke QTP using Dos prompt ?

2 Answers   ABC,


What is positive test case and Negative Test case? What is the meaning of Real World Scenario's?

2 Answers   TCS,


What are metrics and matrix?

0 Answers  


what is run-time object in qtp? explain with example?

2 Answers  


Categories