What is SetTo Propetry and GetTo Property in UFT/QTP, GetRo Property?

SetTo and GetTo Property in UFT/QTP

The SetTo and GetTo properties are most handy for an automation tester when working with objects. In this post, we will uncover the details.



On completion of this post, you would answer the following questions –
what are Test Objects ?
What are Run Time Objects ?
what is GetTOProperty ?
What is SetTOProperty ?
What is GetROProperty ?

Let’s start with the test objects:

Test Objects:

Objects which are present in the object repository are called as test objects.

Test objects in UFT/QTP

Run Time Objects:

Objects present in the application (Application under Test or AUT) are known as Run time objects.

Run time Objects in UFT / QTP

While recording a script, QTP will store the objects, along with the property names and values, in object repository. (We can add the objects to object repository either manually based on requirement).

So, while executing the script, QTP will compare the objects in object repository to the objects present in application (AUT) to check the object existence.



To get the value of particular property of a Test Object, which is stored in object repository.

Example: Open Flight application and record the login functionality

Dialog("Login").WinEdit("Agent Name:").Set "test"
Dialog("Login").WinEdit("Password:").Set "mercury"

The object repository looks like below image:
Object Repository for GetTo Property

Let us validate the stored properties in Object repository:

1.Get the “text” property value of ‘Login’ Dialog

Msgbox Dialog(“Login”).GetTOProperty(“text”)
Output- Login

GetTo in UFT/ QTP

2. Get the “attached text” property value of ‘OK’button

Msgbox Dialog(“Login”).WinButton(“OK”).GetTOProperty(“attached text”)

GetTo in UFT/ QTP 1

Output is Blank because there no value in object repository for “attached text” property

3. Get the “text” property value of ‘OK’button

Msgbox Dialog(“Login”).WinButton(“OK”).GetTOProperty(“text”)
Output – OK

GetTo in UFT/ QTP 2

4. Get the “attached text” property value of ‘Agent Name’

Msgbox Dialog(“Login”).WinEdit(“Agent Name:”).GetTOProperty(“attached text “)
Output – Agent Name:

GetTo in UFT/ QTP 3


To get values of all properties of a particular Test Object, which is stored in object repository.

Let us pick up object ‘AGENT NAME’ as shown in the below image:

GetTo Properties in UFT/QTP

Set a = Dialog("Login").WinEdit("Agent Name:").GetTOProperties 
For i = 0 To a.count-1
    propertyName = a(i).Name 
    propertyValue = a(i).Value
    msgbox propertyName & " - " & propertyValue

nativeclass - Edit
attached text - Agent Name:

GetTo Properties in UFT/QTP

GetTo Properties in UFT/QTP


To set the test object property during run time. This is only temporary change do not affect the values stored in the test object repository.


Msgbox Dialog("Login").WinButton("OK").GetTOProperty("text") 
Output – OK

SetTo Property in UFT QTP

Dialog("Login").WinButton("OK").SetTOProperty "text", "YES"
Msgbox  Dialog("Login").WinButton("OK").GetTOProperty("text")

SetTo Property in UFT QTP 1

Output is ‘YES’ and the value in object repository is also ‘YES’

Object Repository after execution:The change is only temporary. The ‘Text’ property does not change in Object repository.
SetTo in Object Repository in UFT/QTP 


The ‘Native class’ property value is ‘Button’ for ‘OK’ object. See the above image.
Change the ‘native class’ value as ‘Edit’. Now script will fail when user tries to click the ‘OK’ button.

Dialog("Login").WinButton("OK").SetTOProperty "nativeclass", "Edit"

SetTo example in UFT/QTP 


To get the value of particular property of a Run Time Object. (Objects in AUT)


Dialog("Login").WinEdit("Agent Name:").Set "test"
Dialog("Login").WinEdit("Password:").Set "mercury"

Msgbox Dialog("Login").WinEdit("Agent Name:").GetROProperty("text")

Output – test

Get RO Property in UFT/QTP 

Any Questions:

If you have any questions or any kind of doubts in your mind feel free to ask. Please put in the comments section below.

  • TestnBug

    Post your comments/questions/Feedback in this section

  • Pawan Kumar

    Hi ,
    GetToProperty and GetROProperty both used for getting Property value . Than what is difference ? Can you explain with real time Example