if there r 10 windows open in QTP write a command to close
all 10 windows at a time ?

Answers were Sorted based on User's Feedback



if there r 10 windows open in QTP write a command to close all 10 windows at a time ?..

Answer / sandip

Option Explicit
Dim ObjBrow,ObjName,ObjBrowName
Set ObjBrow = Description.Create()
ObjBrow(micClass).values = "Browser"
ObjName = Desktop.ChildObject(ObjBrow)
msgbox = ObjName.count
for i = 0 to ObjName.count
ObjBrowName = ObjName(i).getROproperty("Name")
msgbox(ObjBrowName)
ObjName(i).close
Next

Thanks,
Sandip Gami,
Cell No: 09986645937

Is This Answer Correct ?    11 Yes 1 No

if there r 10 windows open in QTP write a command to close all 10 windows at a time ?..

Answer / kamaldeep singh

If u are using iexplore then use this function
SystemUtil.CloseProcessByName ("iexplore.exe")

For mozilla only change the name i.e iexplore.exe

Is This Answer Correct ?    5 Yes 0 No

if there r 10 windows open in QTP write a command to close all 10 windows at a time ?..

Answer / srinadh

You can use the following function. or simply
SystemUtil.CloseProcessByName "IEXPLORE.EXE"

Public Function CloseBrowser()

SystemUtil.CloseProcessByName "IEXPLORE.EXE"

End Function

Is This Answer Correct ?    4 Yes 1 No

if there r 10 windows open in QTP write a command to close all 10 windows at a time ?..

Answer / venkat

3 menthods are these to close browsers

1) SystemUtil.CloseProcessByName "iexplorer.exe"
2) Do While Browser("creationtime:=0").Exist
Browser("creationtime:=0").Close
Loop
3)Set objWMIService =GetObject"winmgmts:\\.\root\cimv2")
Set colProcess = objWMIService.ExecQuery("SELECT * FROM
Win32_Process")
For Each objProcess In colProcess
If UCase(objProcess.Name) = "IEXPLORE.EXE"
objProcess.Terminate()
End If
Next

Regards,
Venkat
9986635974
bangalore

Is This Answer Correct ?    3 Yes 0 No

if there r 10 windows open in QTP write a command to close all 10 windows at a time ?..

Answer / eswar

cnt = 0
Set desc = Description.Create
desc("Class Name").value = "Window"
Set s = Desktop.ChildObjects(desc)
MsgBox s.count
For i=0 to s.count-1
x = s(i).Close
cnt=cnt+1
MsgBox x
Next
MsgBox cnt

Is This Answer Correct ?    3 Yes 1 No

if there r 10 windows open in QTP write a command to close all 10 windows at a time ?..

Answer / arunsingh

By using
SystemUtil.CloseProcessByWndTitle "*.*", True

Is This Answer Correct ?    4 Yes 3 No

if there r 10 windows open in QTP write a command to close all 10 windows at a time ?..

Answer / a

By using "micclass", we should create Description object.
Then using For loop we count the Dialog objects, and close
it.

Is This Answer Correct ?    1 Yes 1 No

if there r 10 windows open in QTP write a command to close all 10 windows at a time ?..

Answer / mogal

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

Browser("creationtime:=0").Close

Wend

Method 2:

Set odesc = Description.Create
odesc("micClass").Value = "Browser"

Set oBrowCO = Desktop.ChildObjects(odesc)
For i = oBrowCO.Count - 1 to 0 Step -1
Browser("CreationTime:="&i).Close
Next

method 3:
Systemutil.CloseProcessByName "Chrome.exe"

Is This Answer Correct ?    0 Yes 0 No

if there r 10 windows open in QTP write a command to close all 10 windows at a time ?..

Answer / rajesh

can u explain it clearly plzzzzzz

Is This Answer Correct ?    0 Yes 1 No

if there r 10 windows open in QTP write a command to close all 10 windows at a time ?..

Answer / ashok

closedCount = SystemUtil.CloseProcessByName("iexplore.exe")

'Display # of closed windows
MsgBox closedCount


If you want to know more refer this link
http://www.knowledgeinbox.com/documents/closingprocesses.html

Is This Answer Correct ?    2 Yes 3 No

Post New Answer

More QTP Interview Questions

An action has both shared and local or associated to it and both have the same object in them. In the test which one will be considered?

0 Answers  


How to create scenario selector

0 Answers  


Diff b/w Test Design and Test case design? What is the Design Review's and Code Review's. When will you conduct tese reviews?

1 Answers  


What are the benefits of quick test pro(qtp)?

0 Answers  


In an(AUT) web application their are two frames as fraMain and fraFooter. Both the frames contain link which needs to be retrieved at a single step. I tried it using "Regular Expression" as fra.* but QTP doesn't recognize the object. So Plz help me out to get resolve the problem:-)

1 Answers  


How many test scripts are prapare in ur project(HeathCare Insurance).

1 Answers   Virtusa,


1.How to find in which row or column,string "Hyderabad" exist in excel sheet? 2.How to find how many times character "a" repeated in a given string "Koteswararao"

6 Answers   Ness Technologies,


What is the use of sendkeys.In which cases we Use this sendkey.Pls explain with example.

3 Answers   Cap Gemini,


i have read that "non-reusable actions can not be called in any other test".but in 'call to copy action' copies non-reusable action in other test also..can u pls help to understand this..

0 Answers  


After coming to know that QTP could not identify non-standard objects, we set those non-standard objects as virtual objects using Virtual object wizard. But how can we identify that qtp could not identify non-standard objects?

6 Answers  


How to call .vbs functions in QTP? plz Explain indetail

4 Answers   Wipro,


What are benefits of qtp?

0 Answers  


Categories