Sunteți pe pagina 1din 2

For more QTP Scripts, www.ramupalanki.

com
QTP Methods
Activate: It activates dialog boxes/Windows
Syntax: Object hierarchy. Activate
 Ex:
Dialog(“Login”).Activate
Window(“Flight Reservation”).Activate

Click Method: It clicks on an object (Buttons)


Syntax: Object hierarchy. Click
Ex:
Dialog(“Login”).Winbutton(“ok”).click

Close Method: It closes the window,Dialog box, Browser window etc.


Syntax: Object hierarchy. Close
Ex:
Window(“Flight Reservation”).Close
Browser(“Browser”).Close

Dblclick: It Double clicks the object.

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"

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

GetVisibletext: It returns Text from the specified area.


Syntax: Variable =object hierarchy.getvisibletext
Ex:
x=Window("Flight Reservation").WinComboBox("Fly From:").GetVisibleText
msgbox x
For more QTP Scripts, www.ramupalanki.com

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

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

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

Getcontent: It returns all items from a combobox.


Syntax: variable=object hierarchy.GetContent
Ex: x=Window("Flight Reservation").WinComboBox("Fly From:").GetContent
msgbox x

Exist property: It checks whether the object is available or not.


Syntax: Object hierarchy.exist(time in seconds)
Ex: Window("Flight Reservation").Exist(5)

S-ar putea să vă placă și