Custom Search

Wednesday, March 3, 2010

Descriptive programming in QTP

Type I:

Dialog("text:=Login").Winedit("attached text:=Agent Name:").set "UserName"
Dialog("text:=Login").Winedit("attached text:=Password:").set "Password"
Dialof("text:=Login").WinButton("text:=OK").click

In Above Example : - you will get the object properties name and Values from application using Object Repository OR Object Spy, you can use more than one property value for one object.

text is name of the object and Login is valu of the object.

Type II :

Set ObjDesc1=Desscription.create
ObjDesc1("text").value="Login"
Set ObjDessc2=Description.create
Objdesc2("attached text").value="Agent Name"
Set ObjDesc3=Description.create
ObjDesc3("attached text").value="Password"
Set ObjDesc4=description.Create
ObjDesc4("text").value="OK"
Dialog(ObjDesc1).Winedit(ObjDesc2).set "User Name"
Dialog(ObjDesc1).Winedit(ObjDesc3).set "Password"
Dialog(ObjDesc1).WinButton(ObjDesc4).click

In above example:- you can use more than one property value for one object.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.