Sunday, April 3

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.


  1. hi can u explain the get, set properties with more syntax

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


  3. Classic and simple examples Mr.Jain. Thanks for sharing such great knowledge.


  4. hi
    i couldn't get the difference between gettoproperty and getroproperty

    please elaborate a little more.

  5. Thnx... very simple and helpfull

  6. 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.

  7. Awesome ...U r doing a great job..Its really helpful

  8. This blog is very helpful please add more codes with examples for verious topis.

  9. blog is useful? if testing a website how to write script using Descriptive Programming ? can u give me an sample?

  10. Hello Mr Abhikansh,

    Thanks for very useful posts.
    It could be great if you can post some sample projects which completes the whole sense of all your posts.

  11. @Sushma - Thanks for your words. Its not feasible to post whole projects on blog as a project/framework has lots of components!!

    More then happy to help on any queries you have..

  12. @ Nikunj

    GetTOProperty - most commonly used, gives a one particular property
    GetTOProperties - gives all the properties of object in an array
    SetTOProperty - used to set a property at runtime

    I'll try to write a post on it asap. Thanks.

  13. Your information about qtp is really interesting. Also I want to know the latest new techniques which are implemented in qtp. Can you update it in your website?
    Qtp training Chennai

  14. Hi..Interesting posts.. I need to assign a variable to getroproperty..for example I want to write like this..B= Browser("Yahoo Finance - Business").Page("Yahoo Finance - Business_2"). Frame("mainFrame_5").WebElement("O").GetROProperty("innertext") ` Current it possible to write like this?

  15. Technology place a vital part in humans ecosystem. So in order to survive one must be up to date. Thanks for sharing this information in here. Keep blogging article like this. I have bookmarked this page for future reference.

    Hadoop Training Chennai

  16. Nice..You have clearly explained about the conept..Its very useful for me to undertand..Keep on sharing..
    Hadoop training in chennai

  17. Excellant content. To know the details and importance of python course visit below. Python is an object oriented high level programming language which is built in data structures combined with dynamic typing and dynamic binding making it very attractive for rapid application development.
    Python Training in Chennai | Python Course in Chennai

  18. Thanks for Sharing the valuable information and thanks for sharing the wonderful article..We are glad to see such a wonderful article..
    QTP Training in Chennai | QTP Training Institute in Chennai | QTP Training

  19. Excellent sharing. Testing is a wonderful field for IT peoples. Want to learn Selenium Training reach GangBoard. Hadoop Online Training

  20. I would like to say thank you for the amazing details and concepts you are sharing in this.
    Webseiten Gestaltung L├╝denscheid

  21. I found a lot of interesting information here. A really good post
    office 2010 professional plus key deutsch


  22. Thanks For Your valuable posting, it was very informative
    Internet Marketing Dienstleistungen