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

How do you perform testing on web based application using qtp 9.2?

1 Answers  


What is the Maximum syncronization timeout in seconds in QTP 9.5

5 Answers   Polaris,


QTP 9.2, Issue: Creating Shared Object repository. I recorded 2 scripts. I exported the Object Repository to a shared location for the first script. Associated the exported repository to the first script and deleted the Local Repository for the First Script. Now Opened the Second script and try to Add the Local Object Repository of 2nd Script to Exported Object Repository. But I fail. Can anyone please help in providing steps that need to be followed in creating a shared object repository? Thanks in Advance.

3 Answers   Google, UHG,


give me the code to save all messages of inbox of gmail into a folder and notepad

0 Answers   Infosys,


If an application name is changing frequently i.e while recording it has name “Window1” and then while running its “Windows2” in this case how does QTP handle?

7 Answers   Covansys,






How many ways to configure the application in QTP,Explain

2 Answers   CTS,


What is diff. between ordinal identifier INDEX and Location?

3 Answers  


They asked by using qtp recording writing scripting

0 Answers   Wipro,


How to covert a String to an integer?

5 Answers  


what testing activities u may want to automate?

2 Answers  


Give the syntax to import/export xls into qtp.

0 Answers  


how can i use text check point in descriptive programming. or else is there any way to compare the text in the application and the text in data table.

2 Answers  


Categories