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 / 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

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

Answer / sudheer kumar putsala

if Browser("micClass:=Browser","index:=0").Exist(0) Then

Browser("micClass:=Browser","index:=0").Close


Above line of code will close all the open Browsers.

Is This Answer Correct ?    2 Yes 5 No

Post New Answer

More QTP Interview Questions

from where we will retrieve data for data driven tests in qtp?

3 Answers  


how can we retrieve ten rows from the data table using loop concept?

4 Answers  


how we can know qtp has used smart identification machanism during the execution.

3 Answers   IBM,


Associated files in QTP?

1 Answers  


What scripting language is QTP of?

1 Answers  






Hi! Using Descriptive Programming How do we get Parent object for an object by writing script(DP). Say, i want to get a parent object for a "Link" in a web page by writing script in Descriptive Programming.

0 Answers  


what is the data driven testing?

0 Answers  


what is the Command used to start the QTp from Run.

7 Answers  


What are the properties you would use for identifying a browser and page when using descriptive programming?

0 Answers  


What is regular expression?

0 Answers  


There are two tabs in the application suppose, A and B.On clicking the tab "A" one table grid will open. if u click on tab "B" Another table gride will open. Now can I do some operations on both table grids with a single table grid properties in the object repository? I have added all objects of the first table grid into the object repository Now iam checking enable/disable status of "save button" in the second table grid my code is like this val=javawindow("zseries").javabutton("save").getroproperty ("enabled") when I highlighting the save button in the object repository by keeping open the second tablegrid on the application.It is displaying the popup message"The selected object can not be found in the application" can I use properties of one table grid for both tabs if so how it is possible. Can anyone help me

2 Answers   Livetek,


How QTP integrate with application?

1 Answers  


Categories