QTP Methods

 QTP Methods / Operations
1) Activate Method

It activates dialog boxes/Windows

Syntax: Object hierarchy. Activate
Window(“Flight Reservation”).Activate

2) Click Method
It clicks on an object (Buttons)
Syntax: Object hierarchy. Click

3) Close Method
It closes the window,Dialog box, Browser window etc.
Syntax: Object hierarchy. Close
Window(“Flight Reservation”).Close

4) Dblclick 
It Double clicks the object.

5) Set Method
It can be used in three ways.
a. For setting the value of an edit box
Syntax: Object Hierarchy. SET “Value”
Ex: Dialog (“Login”).WinEdit(“Agent Name”).Set “asdf”

b. Selecting a Radio Button
Syntax: Object Hierarchy. Set
Ex: Window("Flight Reservation").WinRadioButton("Business").Set

c. Selecting/Deselecting check boxes
Syntax:object Hierarchy.Set “ON/off”
Ex: Window ("Flight Reservation"). Dialog("Open Order").WinCheckBox("Order No.").Set "ON"

6) Select Method:
It is used for selecting an item from a combo box or list box.
Syntax: Object hierarchy.select “item”
Window("Flight Reservation").WinComboBox("Fly From:").Select "London"
Window("Flight Reservation").Dialog("Flights Table").WinList("From").Select "12572

7) GetVisibletext: It returns Text from the specified area.
Syntax: Variable =object hierarchy.getvisibletext
x=Window("Flight Reservation").WinComboBox("Fly From:").GetVisibleText
msgbox x

8) GetRoproperty:
It returns current object property value. It can be used for getting any object’s, any property value.
Syntax: Variable = object hierarchy.getroproperty (“property name”)
Ex: x=Window("Flight Reservation").WinEdit("Tickets:").GetROProperty ("width")
msgbox x

9) Navigate Method:
It opens a specified URL in the Browser.
Syntax: object hierarchy.navigate “URL”
Ex: Browser("Yahoo!").Navigate http://www.google.co.in/

10) Getitemscount: It returns number of items in a combobox.
Syntax: Variable=object hierarchy.getitemscount
Ex: x=Window("Flight Reservation").WinComboBox("Fly From:").GetItemsCount
msgbox x

11) Getcontent: It returns all items from a combobox.
Syntax: variable=object hierarchy.GetContent
Ex: x=Window("Flight Reservation").WinComboBox("Fly From:").GetContent
msgbox x

12) Exist property: It checks whether the object is available or not.
Syntax: Object hierarchy.exist(time in seconds)
Ex: Window("Flight Reservation").Exist(5)


when we will use set

for ex

set obj= Browser(" ").page(").

Obj = Browser(" ").page(").

Please any body explain

If we have to write the statement for multiple times we use Set Obj Method
Set ObjBr = Browser(" ").Page(" ")
Obj.WebEdit(" Aname").Set " "
Obj.WebEdit(" Pwd").Set " "

Post a Comment