You are on page 1of 2

Basically you would use GetROProperty to get the value of an object property during runtime, such as

the current list/combo item selection, or the text in a WebEdit, or the size of an object (width & height).

The GetTOProperty returns the value of the property from the test object's description, i.e., the value
used by QTP to identify the object. If the property is not part of the test object's description, a warning
will be issued by QTP.

The SetTOProperty changes the value of a test object property. Changing the property doesn't affect the
OR or Active Screen, but just the way QTP identifies the object during runtime. Actually, this changes the
properties of the temporary copy of the object stored in RAM by QTP.

Well, I see that you have understood that GetROProperty refers to the runtime actual values the object's
properties possess.

The GetTOProperty could be exemplified this way:


Code
GeSHi (qtp):
Msgbox Browser("Sign in to Yahoo!").Page("Sign in to Yahoo!").WebEdit("login").GetTOProperty("name")

'Would retrieve the object name from the test object description, whether it's in the OR or DP defined.

Created by GeSHI 1.0.7.20

The SetTOProperty could be exemplified this way:


Code
GeSHi (qtp):
Set obj = Browser("name:=Sign in to Yahoo!").Page("title:=Sign in to Yahoo!").WebEdit("html
id:=username")

msgbox obj.GetTOProperty("html id")

'Would retrieve the object html id from the test object description, whether it's in the OR or DP defined

'Now we set the name property

obj.SetTOProperty "name", "login"

'And retrieve it

msgbox obj.GetTOProperty("name")

SetTOProperty is used to temporarily modify an object property value in QTP. I say temporarily
because, the change value is not stored in the OR.

GetTOProperty is used to retrieve a (or any number of) desired property value(s) of an object in QTP.

GetROProperty and Exist method can be used interchangeably. This method is used to retrieve in
run-time, a property value to ensure if that object was available during a specific point in the run
session.
Eg. Browser("XYZ").Page("XYZ").WebRadioGroup("ABC").GetROProperty("Value")

Use GetROProperty to retrieve properties listed in Object Spy


The GetTOProperty will only return the value of a property that is listed in the Object Repository. To
retrieve the value of a property that is listed in the Object Spy, use the GetROProperty method.

Example:
msgbox Window("Flight Reservation").WinComboBox("Fly From:").GetROProperty("items count")

Alternatively, you can add the desired property to the Object Repository, then use the GetTOProperty
method.

TOProperty -> the property for an object stored in your repository

ROProperty -> the current value for a property during test run time

SetTOProperty -> change the value of an object property stored in your repository (the cahnge will not be
saved, only available during runtime of your current action)

You might also like