Monday, August 11, 2008

Can the class of an object be retrieved using the logical name

QTP does not have a method or function to retrieve the class of an object based on the logical name. This is a limitation of the QTP product.
However, you may use a unique property of an object to determine the class of the object. Include the unique property in a description object then use the ChildObjects method to capture a collection of the objects which have that description. The GetROProperty method can be used on each object in the collection to get the "micclass" property.
Set oDesc = Description.Create()oDesc( "text").Value = "Cancel"Set child = Dialog("Login").ChildObjects (oDesc)msgbox child(0).GetROProperty("micclass")

No comments: