| || |
Find() objects that are visable
So, I've been using the Find() method to dynamically locate objects that are created on the fly. Problem is... There are lots of objects returned, not all of which are viewable. In my example, I am searching for textboxes by using the following:
oFoundTextBoxes = knownObject.Find(AtList(AtDescendant(".class", "Html.TABLE"), AtChild(".type", "text")))
I now have an array of textboxes, but not all are actually visable on the screen. So if I try oFoundTextBoxes(1).SetText("testing") I get an exception saying no ScreenPoint could be found if element 1 is not actually displayed on the screen.
I'd like my Find() to only return text boxes that are visable.
Any help is appreciated.
Re: Find() objects that are visable
You'll need to parse through the returned array and do this yourself. These non-viewable objects can come in really handy, which is why I assume they added them. Replace all the calls to "find" to the new one that strips out the unrequired ones. In the new method, use a Vector to add the useful objects into a List, then return it.
To determine which are useful, you could try to catch the screenpoint exception. If it is thrown, don't add the object, otherwise add it. There's probably a neater/faster way to do it, but it should work.