How can I -without iterating, i.e. by using .ChildObjects
- match all test objects with any non-zero value in a number property?
Contained question: Can I match, using a regex match, a property value that contains a number
(i.e. VarType
returns 3 (vbLong
) for the getROProperty value of this property) using a regex match? I don't think so.
For example:
Dim Descr: Descr=Description.Create
Descr ("micclass").Value="WebElement"
Descr ("height").Value=11
matches some controls in my web application, i.e. Page.ChildObjects (Descr).Count > 0
.
But assigning the 11
as a string, i.e. changing the height line to:
Descr ("height").Value="11"
matches zero controls.
This is quite bad, since consequently, I am unable to look for test objects with height
not equal to 0. That would've been exactly what I need.
I'd use
Descr ("height").Value="^[1-9][0-9]*$"
Descr ("height").RegularExpression=true
to search for all instances with nonzero height
values, but since the string search does not match, the regex match won´t work, too. (In fact, it indeed doesn´t).
It is known that integer types has to be passed as integers in the description rendering the usage of regular expressions useless unfortunately.
I do not have a QTP installation at hand right now, but to investigate it further, what happens if you use
Print Browser("myBrowser").WebElement("height:=11").ChildObjects.Count
and
Print Browser("myBrowser").WebElement("height:=^[1-9][0-9]*$").ChildObjects.Count
Where "myBrowser"
is your browser definition of course.