Converting or (Object Repository) Based Scripts To Descriptive Programming - Tarun Lalwani
Converting or (Object Repository) Based Scripts To Descriptive Programming - Tarun Lalwani
Descriptive Programming
Author(s): (1) tarun_lalwani
Keywords:
QTP, Quick Test, Quick Test Pro, Descriptive Programming, Programming Description
Introduction:
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
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
Now let’s look the below statement and try and convert it to DP
Browser("Browser").Page("Google").WebButton("Google Search").Click
Converting WebButton(”Google Search”)
type = submit
Now to conver the WebButton(”Google Search”) to its DP counterpart we can use two different
methods
Browser("Browser").Page("Google").WebButton("type:=Submit", _
"name:=Google Search", "html tag:=INPUT").Click
Method 2 – Using Object Description
In this we first create a description of the object and then use it in the statement
Browser("Browser").Page("Google").WebButton(oGoogleSearch).Click
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
DP Converted script
SystemUtil.Run "C:\Program Files\Internet Explorer\IEXPLORE.EXE"
Browser("micclass:=Browser").Page("Page").Sync
Browser("micclass:=Browser").Navigate "http://www.google.com"
Browser("micclass:=Browser").Page("micclass:=Page").WebEdit("name:=q").Set _
"KnowledgeInbox"
Browser("micclass:=Browser").Page("micclass:=Page") _
.WebButton("type:=Submit", "name:=Google Search", "html tag:=A").Click