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

Hi Guys, In one of my interviews, I was asked to Write a paragaraph explaining how much scripting I did in QTP? I don't know where to start and what to write. So I need your help in writing that.

1 Answers  


Can any one tell me how to write a script for selecting open option in File menu of A word document.here you have to add objects to OR.try like that and give me the ans.i asked this question to so many but no one knows.if any one know the answer plz let me know

0 Answers  


.qfl extension for which file? where vl use it

3 Answers   iFlex,


Want to verify notepad reports using QTP framework or any other BV script method. Can anyone share the method to achieve it? Eg. Person Name is the header and the actual name is John then how can we verify weather person name is John

0 Answers   IBM,


How to check the URL using Automation tool QTP

2 Answers  






Functions call by reference and call by value. i want the diff b/n these 2 and how will be the script for this?in which situation we use these 2..?pls explain me clearly

0 Answers  


What is post recovery scenario?

0 Answers  


How can we close all webbrowsers which are opened in out desktop?

3 Answers  


what is object repository?

4 Answers  


When should I use smart identification?

0 Answers  


Can we create a qtp test from qc?

0 Answers  


What is the use of Debug Viewer?

0 Answers  


Categories