DP Part 2 – Converting OR based scripts to DP

This article discusses how we can convert an Object repository based script to DP based script. For this we will do a simple recording of entering some text on Google.com search text box and clicking the Google search button

The QTP generated script would look something like below

All the names used between “” are logical name of the objects in the Object Repository (“Browser”, “Page”, “Google”, “q”, “Google Search”) as shown in below image

Object Repository for the recorded script

Object Repository for the recorded script

Now let’s look the below statement and try and convert it to DP

Converting WebButton(“Google Search”)

The Google Search object present in the OR has following properties

type = submit

name = Google Search

html tag = INPUT

Now to conver the WebButton(“Google Search”) to its DP counterpart we can use two different methods

Method 1 – Using String Description

In this we use string parameters to specify the object properties

Method 2 – Using Object Description

In this we first create a description of the object and then use it in the statement

Which method of DP to choose?

The later articles of this DP Part X series would be discussing in details when and where to use for which method. For now just understand that both methods have their own advantage and disadvantages

Few difference IMO are listed below

String Description

Object Description

Uses less memory as strings are used

Requires more memory as objects are created. Object creation is as such a overhead

Increases statement length in case more than one property is to be used

Increase lines of code due to object creation overhead and property assignment

Preferred when property value have regular expression characters which needs to be treated literally

(explained in one of the later articles)

DP Converted script

Note: We will discuss more in details about micclass used above in later articles

Have questions related to this article? Want to request a new article? Use our forums to post your questions

  1. Suscribe to Email

    Enter your email address:

    Delivered by FeedBurner