Descriptive Programming in QTP – Part 4

Hello Friends!

In Part-1, Part-2, Part-3 of this post we learned basics, type, use and various methods of descriptive programming.

In this part we will continue with more good stuff.. 🙂

Apart from GetROPropety, these are some other methods which are very useful in DP.

– GetTOProperty
– GetTOProperties

– SetTOProperty

GetTOProperty returns the value of the specified property from the test object description.

Msgbox Browser(“MyBrowser”).Page(“MyPage”).GetTOProperty(“html tag”)

GetTOProperties returns the collection of properties and values used to identify the object.

Set Propset = Browser(“MyBrowser”).Page(“MyPage”).GetTOProperties
Above statement will give you all the properties used in object identification by QTP to an array Propset. All these properties and values can be retrieved using below code..

For i = 0 to Propset.Count-1
    Print Propset(i).Name & “:=” & Propset(i).Value

SetTOProperty is used to set the value of the specified property in the test object description. It is used when you require to change the any particular property at run time.

For Example you need to work open/work on two instances of an application at same time. Obviously, all the properties will be same. In this situation you can use SetTOProperty to change properties at run-time.

Please note that changes made by SetTOProperty will be applicable at runtime only. Once your execution is finished, no change will be saved. Also changes will be applicable to that action only.

Browser(“MyBrowser”).Page(“MyPage”).WebElement(“my text”).SetTOProperty “Style”, “‘color:blue'”

Feel free to post comments if you have any question from this or last three posts.

7 thoughts on “Descriptive Programming in QTP – Part 4”

  1. All the posts are Very Good and really helpful.
    Thanks for sharing such a good knowledge on site.


  2. Hi Abhikansh,
    First of all thanks for this informations which are really help full.
    I have question that how a tester use these properties (GetTOProperty,GetTOProperties,SetTOProperty) in real testing environment.
    I want to understand the concept of using these properties.

    I hope you will explain this very well.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top