What is descriptive programming in qtp?

Showing Answers 1 - 12 of 12 Answers

ujwal

  • Jan 3rd, 2007
 

Descriptive programming is a technique by which we can perform actions on objects which are not in the object repository.

The below example uses descriptive programming to login to an application by providing the user id and pwd

There are two ways in which descriptive programming can be used :

* By creating properties collection object

Dim uid,pwd
Dim objPropBrowser,objPropPage
Dim objPropImageLogin,objPropWebEditUsrName,objPropWebEditPwd

uid="abc"

pwd="123"

Set objPropBrowser  = Description.Create
Set objPropPage  = Description.Create
Set objPropImageLogin = Description.Create
Set objPropWebEditUsrName  = Description.Create
Set objPropWebEditPwd  = Description.Create

objPropBrowser("name").value="Login"
objPropBrowser("title").value="Login"

'objPropPage("name").value="root"
objPropPage("url").value="url link"
objPropPage("title").value="Login"

objPropWebEditUsrName("name").value="username"
objPropWebEditUsrName("type").value="text"

objPropWebEditPwd("name").value="password"
objPropWebEditPwd("type").value="password"

objPropImageLogin("name").value="Image"
objPropImageLogin("image type").value="Image Link"
objPropImageLogin("alt").value="Login"
objPropImageLogin("abs_x").value="510"
objPropImageLogin("abs_y").value="334"
objPropImageLogin("x").value="510"
objPropImageLogin("y").value="241"

Browser(objPropBrowser).Page(objPropPage).WebEdit(objPropWebEditUsrName).Click
Browser(objPropBrowser).Page(objPropPage).WebEdit(objPropWebEditUsrName). Set uid
Browser(objPropBrowser).Page(objPropPage).WebEdit(objPropWebEditPwd). Set pwd

'Browser(objPropBrowser).Page(objPropPage).WebEdit(objPropWebEditUsrName). Set "ujwal"
'Browser(objPropBrowser).Page(objPropPage).WebEdit(objPropWebEditPwd). Set "password"

Browser(objPropBrowser).Page(objPropPage).Image(objPropImageLogin).Click

* By giving description in the from of string arguments.

Dim uid,pwd

uid="abc"

pwd="123"

Browser("title:=Login","name:=Login").Page("title:=Login").WebEdit("name:=username","type:=text").Set uid
Browser("title:=Login","name:=Login").Page("title:=Login").WebEdit("name:=password","type:=password").Set pwd
Browser("title:=Login","name:=Login").Image("name:=Image","file name:=b-login.gif").Click

  Was this answer useful?  Yes

sunkumaranr

  • Aug 27th, 2009
 

Programming is done without using the object repository is called Descriptive
Programming.
Difficult to find the object identification then we will go with regular
expression
or
Descriptive Programing it means identifying object unique properties from the
script itself.
Ex:
Dialog( text: login ).winedit( attached text: Agent Name: ).set mercury dialog(
text: login ).winedit( attached text: password: ).set mercury dialog( text:
login ).winbutton( text: OK ).click

  Was this answer useful?  Yes

Descriptive programming is used when we want to perform an action and the object is not present in object repository.

Descriptive programming uses unique properties to identify any object.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions