Descriptive Programming in QTP ? and How It Works ?

Descriptive Programming is a method of performing operation on the object which is not there in Object Repository. You can also use programmatic descriptions to perform the same operation on several objects with certain identical properties, or to perform an operation on an object whose properties match a description that you determine dynamically during the run session.

Types of Programmatic Descriptions

1. Static: - You list the set of properties and values that describe the object directly in a VBScript statement.
a. Direct specification of description in script
Browser(“micclass:=Browser”).Page(micclass:=page”).Link(“name:=Login”).Click
b. Assigning description to the variables and use that variables in script
g_MainBrowser = “micclass:=Browser”
g_MainPage = “micclass:=Page”
g_Lnk_Login = “name:=Login”
Browser(g_MainBrowser).Page(g_MainPage).Link(g_Lnk_Login).Click

2. Dynamic: - You add a collection of properties and values to a Description object, and then enter the Description object name in the statement.

Set oBrowser = Description.create
oBrowser (“micclass”).value=”Browser”
oBrowser (“name”).value= “Google”
Set oPage = Description.create
oPage (“micclass”).value=”Page”
oPage (“name”).value= “Google”
Set oLink = Description.create
oLink (“name”).value= “Login”
oLink (“index”).value= 1
Browser(oBrowser).Page(oPage).Link(oLink).click

Using the Static type to enter programmatic descriptions directly into your statements may be easier for basic object description needs. However, in most cases, using the Dynamic type provides more power, efficiency, and flexibility.




To receive daily posted JOBS & Interview Questions
Just enter your email address below and click 'Submit'
Enter your email address:

Make sure to activate your subscription by clicking on the activation link sent to your email