Monday, July 1

Descriptive Programming in QTP - Part 1

Hello Friends,
In this series of post, we'll learn in detail how to use Descriptive programming (DP) in QTP.

Before starting DP, let's understand the basics about object identification. There are two ways, QTP uses to recognize the objects present in your application.

1. Object Repository (OR)
2. Descriptive Programming (DP)

What is Object Repository (OR)?

OR is the simple and default way of object identification in QTP. Object Repository is a storage place of QTP, where  properties and values of every object are stored. While you record on application, all the objects you click/interact, are stored in Object Repository.

During the play back QTP use this OR to identify the object on which the action is to be performed.

What is Descriptive programming (DP)?

We'll use DP when we want to bypass OR. Descriptive programming is used when we want to perform an operation on an object that is not stored in the object repository. This way QTP won’t search for the object properties in the Object Repository, but will take it from the DP statement of your code.

Why use Descriptive programming (DP)?

Everything looks fine while automating test using OR, then why should I use DP?

Well, there might be many valid reason to do so. Think about a situation - you want to close all opened browser automatically before you start executing your script. Here OR will not help you to identify an object as it is not possible to store all the opened browser objects into OR. Make sense?

I am not very good in vbscript. Is it mandatory to learn vbscript explicitly to write DP?

No. Not at all! Its not mandatory, but yeah.. recommended. For basic operations and starting with DP, this post will guide you.
Although, for advanced operations i.e. using COM, AOM, complex frameworks etc. vbscript knowledge is the key.

Okie guys! Now, let's start writing DP!

Types of Descriptive Programming (DP):

DP can be written in two ways..

1. Static (by provide the set of properties and values directly)
2. Dynamic (by creating description object)


- In Static method of DP, we provide the set of properties and values directly in a single line, in form of the string arguments.

Here is the format/syntax of DP..
object's Class Name("property name:=property value")

Exmp 1: webbutton(“Name:=Google Search”)

object's Class Name = webbutton 
property name = Name
property value = Google Search

Exmp 2:- Browser(“google”).page(“google”).webbutton(“name:=Google Search”,”type:= Submit”).click

In above statement, Browser(“google”) and page(“google”) are written using OR. And webbutton(“name:=Google Search”,”type:= Submit”) is written using DP. 

Please note that we can write multiple set of properties and values in any DP statement.

webbutton(“name:=Google Search”).click
webbutton(“name:=Google Search”,”type:= Submit”).click
webbutton(“name:=Google Search”,”type:= Submit”,"x:=301").click

TIP: A statement can be written by combining OR and DP approach, but OR can be used only before DP. once you use DP, you can't write OR after it.

Correct: Browser(“google”).page(“google”).webbutton(“name:=Google Search”,”type:= Submit”).click

Above statement is correct because DP(webbutton(“name:=Google Search”,”type:= Submit”)) is written only after OR(Browser(“google”).page(“google”)).

Incorrect: Browser(“name:=google”).page(“title:=google”).webbutton("Google Search").click

Above statement is incorrect because DP (Browser(“name:=google”)) is used before OR.

We can get the all properties and values of object using Object Spy.

Okie!! Let me add one more point here. You can use variable also in Descriptive Programming (DP)!! Here we go...

Dim var_name
var_name = "Google Search" 
webbutton(“name:=” & var_name).click

Key Points:

  • Object Repository (OR) and Descriptive Programming (DP) are two ways, QTP uses to recognize the objects.
  • These two ways are also known as Object Identification techniques.
  • Descriptive Programming (DP) can be done in two ways - Static and Dynamic.
  • A statement can be a combination of both OR and DP approach
  • OR approach can be used only before DP. once you use DP in a statement, you can't write OR after it.
  • Properties and values of object for DP are captured using Object Spy.
  • Variable also can be used for property values in DP.

In next part of post, we'll discuss another type of DP - Dynamic.

In case of any queries, please post your comments.


  1. This section was really useful.

  2. @Anonymous

    Thanks. Keep reading the good stuff!

  3. Very Nice brief article about OR and DP.I wish you had provide some examples on DP's description object too...


  4. @Pankaj

    plz check all parts of the post and if still you have any question, plz let me know :)

    Descriptive Programming - Part 1
    Descriptive Programming - Part 2
    Descriptive Programming - Part 3
    Descriptive Programming - Part 4

  5. Hi AbhiKansh Jain,can u give examlpes for Webtables in QTP

  6. Which is best way to write script.ether DP or in OR?

  7. generally mixed approach is most fruitful...

  8. Hello Abhikansh,

    You are doing a great job... Keep doing...!!

  9. The reason why I choose DP is because I am so fed up with OR and doing 'existing call'.

    I dont dont understand after the "page" part, the number just keep on increasing.

    Ex.: Browser(“google”).page(“google_2”).

    That is why I choose DP. But how far can I go with DP?

  10. Hi Abhishek,

    I have one question here......

    Can you please let me know that how to recognize menu options in descriptive programming in qtp.

    Can you please let me know how to write DP for below mentioned example i.e.

    Window("Flight Reservation").WinMenu("Menu").Select "File;New Order"
    Window("Flight Reservation").WinMenu("Menu").Select "Analysis;Reports..."

  11. Replies
    1. this is ramanjaneyulu from hyd i know the qtp and manual and db but how to prepare the resumes, how to attended the intertives if don't main pls help me this is my mail id

  12. hi,

    Can u tell any ecommerce project so that i can practice....

    1. this is ramanjaneyulu from hyd i know the qtp and manual and db but how to prepare the resumes, how to attended the intertives if don't main pls help me this is my mail id

  13. @ramanjaneyulu

    Regarding resume, i'll say..

    - Write only what you know
    - whatever you write, you must know :)

  14. Abhi,

    Great Post, I have been using QTP for over 6 years but havent seen such a brief intro for OR and DP.

    Thanks keep writing.

  15. Excellent Post. Also visit

  16. Excellent Post. Also visit

  17. That was awesome tutorial. Thanks again.

  18. You have done a good job, keep it up Bro....

  19. Do we need to do any setup before executing the below code?

    Dim var_name
    var_name = "Google Search"
    webbutton(“name:=” & var_name).click

    Note: I'm getting error while running this code,So kindly suggest

  20. Perfect!!! What I can say in this article is very important to be written as it may help everybody to get awareness. Good job done. R Programming Training | DataStage Training | SQL Training | SAS Training | Android Training | SharePoint Training

  21. This comment has been removed by the author.

  22. Thanks for the useful post. Keep posting more like this.
    Webdesign Lüdenscheid

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


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

  25. Your website content nice nice and interesting to observe.
    jobbörse Neunkirchen

  26. Nice post keep do posting The Info was too good, for more information regarding the technology Click
    Amazon web Services Training
    Salesforce certification Training program
    Best Salesforce Training in India

  27. The blog which you have shared is very much useful to us. Thanks for your sharing this information.
    SAS Training in Chennai
    SAS Course in Chennai
    SAS Training Institutes in Chennai
    SAS Institute in Chennai

  28. Thanks for sharing the post. Kanhasoft is the Django Application Development Company in India and USA. We are developing enterprise solutions to boost business. Visit our site to know more.

  29. Thank you for taking the time and sharing this information with us. It was indeed very helpful and insightful while being straight forward and to the point.
    Java Training in Chennai
    Java course in Chennai
    Angularjs Training in Chennai
    Selenium Training in Chennai
    German Classes in Chennai
    Java Training in Anna Nagar
    Java Training in Velachery

  30. Thanks for good post. Nice content from your blog. Keep updating. Best Play School in Velachery

  31. Home buying mistakes costs the investors more. Thanks for sharing an informative post. This helps me to rectify the mistakes when buying a home.
    Properties in Chennai
    Flats for sale in Vadapalani
    Builders in Chennai

  32. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
    msbi online training

  33. I m Really looking forward to read more. Your site is very helpful for us .. This is one of the awesome post i got the best information through your site and Visit also this site
    Black satta king
    disawar satta king
    gaziabad satta king
    faridabad satta king
    gali satta king

  34. nice Post! Thankx for sharing this post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
    Digital Marketing Course in Delhi
    best matrimonial site
    redbus ticket online booking

  35. This comment has been removed by the author.

  36. If you are the kind of programmer, that code just for fun, then you should definitely get you a copy of the A+ programming language, so that you can easily start to program.List of ruby on rails IDE

  37. In this way, a little occurrence like figuring out how to stroll to getting a degree in reasoning, both go under the expansive umbrella of instruction. Instruction is what shows us certainties and realities of life the same.
    learn to read quran with tajweed

  38. The web based examining opportunity gives extra comfort and adaptability to help you in accomplishing your objectives. As the training part is developing and will keep on growing, the blasting pattern is the best assurance for you to genuinely consider the instruction degree for an instructor or a teacher is an honorable occupation.religion and the classroom

  39. My kids went to this amazing tech camp last year and they will go there again. Only 8 students per class, great instructors. In case you are interested, it is Integem Holographic AR Design & programming Camp.
    Summer Camp

  40. Thanks For sharing this Superb article.I use this Article to show my assignment in is useful For me Great Work. fun88


  41. I am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly.I want to inform about datastage online training and iib tutorial

  42. I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic.

    sas online training

  43. This number betting game lets each player to pick the numbers and acquire enormous total cash.satta king


  44. Wow. That is so elegant and logical and clearly explained. Brilliantly goes through what could be a complex process and makes it obvious.I want to refer about the best datastage online training and core-java-video-tutorials

  45. Don't look upon this new hobby as a way to save yourself a lot of money, as writing your own version of most of the programs that you need to pay for now will be out of your reach.ergonomic chair for back pain

  46. I think that thanks for the valuabe information and insights you have so provided here. Learn more

  47. Whatever we gathered information from the blogs, we should implement that in practically then only we can understand that exact thing clearly, but it’s no need to do it on sharepoint online training , because you have explained the concepts very well. It was crystal clear, keep sharing..

  48. In this article understand the most important thing, the item will give you a keyword rich link a great useful website page:

  49. am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this,
    AWS training in Chennai

    AWS Online Training in Chennai

    AWS training in Bangalore

    AWS training in Hyderabad

    AWS training in Coimbatore

    AWS training

  50. Incredible data. Fortunate me I went over your site by some coincidence (stumbleupon). I've book-checked it for some other time!

    best interiors