I have a subform that typically contains N+1 child objects: typically 1 header element and N rows. I want to get the number of children, without making assumptions on the number of non-Row children (ie. I don't want the script to break just because a footer element was added). All of the rows have the RO property "name" set to "sfRow" (while the header's name is set to "sfHeader"). So following the lead of other QTP testing domains, I wrote:
Function GetNumRows( testobjSubform )
Dim oMatchingDesc
Set oMatchingDesc = Description.Create()
oMatchingDesc("name").value = "sfRow"
GetNumRows = testobjSubform.ChildObjects( oMatchingDesc ).Count
End Function
This function consistently returns N+1, not the desired N, nor 0 (which would indicate my Description was filtering too much).
So, I assume AcroQTP's implementation of object.ChildObjects( [x] ) is different from all other (example help-doc below) implementations of object.ChildObjects( [x] ). Is this correct?
Thanks,
Brent
Important Informationobject.ChildObjects ([Description])
Syntax Details| Argument | Description |
| object | Any Visual Basic test object. |
| Description | Optional. An Object object. The Properties (collection) object containing the description of the objects you want to find. Tip: You can retrieve a Properties collection using the GetTOProperties method or you can build a Properties collection object using the Description object. For more information on the Description object, refer to the Utility section of the QuickTest Professional Object Model Reference. |
North America
Europe, Middle East and Africa
Asia Pacific