Description object is Used to create a Properties collection object in QTP.
Description object has one method - Create
It returns a properties collection object in which you can add a set of properties and values in order to 
specify the description of an object.We can add any number of properties to define the description object in QTP
Syntax
set Myobject = Description.Create 
Example
Below example uses the 
Create method to return a Properties 
collection object named Myobject  
set Myobject = Description.Create() 
Myobject ("Name").Value = "userName" 
Myobject ("Index").Value = "1" 
Browser("Myb").Page("myp").WebEdit(Myobject ).Set "sagar"
Another Example - 
In below example we are finding the all links from the page whose innertext property is in digits.
Please note that value of the property is considered as regular expression by default . But if you don't want to  treat the value as regular expression, Then set it to False like this 
 '  objLinkDash("innertext").RegularExpression =False
        Set objLinkDash = Description.Create
objLinkDash("micclass").Value = "Link"
objLinkDash("innertext").Value = "\d*"
objLinkDash("innertext").RegularExpression = True
objLinkDash("micclass").Value = "Link"
objLinkDash("innertext").Value = "\d*"
objLinkDash("innertext").RegularExpression = True
       ' By Default it is considered as regular expression
cnt = constobjParent.childobjects(objLinkDash).count
Set childs = constobjParent.childobjects(objLinkDash)
cnt = constobjParent.childobjects(objLinkDash).count
Set childs = constobjParent.childobjects(objLinkDash)
Description object is used to create objects whose properties are changing at run time.  
No comments:
Post a Comment
Please Leave your reply. We value your feedback and inputs