05-12-2008 12:15 PM - last edited on 08-17-2014 08:14 PM by Lisa198503
How does one programmically get all the test object (and run-time) properties of an object, like the way the Object Spy gets them? This appears to be especially frustrating when trying to get the properties of an object when descriptive programming. In that case, using GetTOProperties usually only returns 1 or 2 object properties. With the object repository, using GetTOProperties still doesn't get all the object's properties. Is there some other way to get the properties of an object?
P.S. This thread has been moved from Quality Center Support and News Forum to Unified Functional Testing (formerly QTP) News and Support Forum. -HP Forum Moderator
05-12-2008 12:38 PM
There is not an easy way getting all the properties of an object that are available. One way might be to keep a list of all possible properties and iterate over them to find which are available to that object.
Out of curiosity, why do you need to know all properties for a given object?
05-13-2008 05:31 AM
GetTOProperties only returns what properties were "actually" used to identify the object "as stored" in your OR. If I understand you correctly, you want to programmatically get
a) all possible test object properties for a given test object.
b) all "runtime" / "native" properties and methods for an object.
Let me address (b) first. While this is possible, the answer depends on the application platform, for eg: java, .NET etc. You can't do that for standard windows objects as they don't support RO properties.
Now, for (a):
Take for eg: Browser object.
Goto Registry, say HKLM -> Software -> Mercury Interactive -> QuickTest Professional -> micTest -> Test Objects -> Browser -> Properties. This will give you the same list Object Spy shows. All you have to do is to get this list from the registry programmatically.
05-13-2008 11:33 AM
Thanks for your responses. There are a few things I wanted this for. One of them being able to determine if an object is enabled in a very generic script using descriptive programming. Fortunately, Mark Smith on TDForums.com provided a great solution to getting the properties and their values, of which I'm copying his example below:
Set Obj = Browser("micClass:=Browser").Page("micClass:=Page"
For i = 0 to Obj.Attributes.Length-1
Reporter.ReportEvent micGeneral, Obj.Attributes(i).Name,Obj.Attributes(i).Value
Using this technique worked perfectly in the script I'm creating.
05-13-2008 01:42 PM
08-11-2014 05:45 AM
How can we get methods available for test objects from Registry? Can you please provide any details?