Forum Discussion
What about ObjectIdentifier or idStr? Usually, if the page is constructed well, these will have unique values for each control.
Not at this case....
Refer to the attached Object Spy snapshots
- tristaanogre8 years agoEsteemed Contributor
OK, I see what's going on...
You're calling "FindChild" from the page level... That's going to search the entire tree at the page level for the object... and it will grab whatever it finds as the first item. Since all the Select boxes are identified pretty much the same way, it's the tree hierarchy that is the identifying factor keeping them separate. You need to start your search closer within the hierarchy to the object you're wanting to select. I'm assuming that the "Gender" panel can be found by caption or label or innerText or something. Once you find that panel, then you can do a "FindChild" to find the select box you need.- Colin_McCrae8 years agoCommunity Hero
tristaanogre wrote:
You're calling "FindChild" from the page level... That's going to search the entire tree at the page level for the object... and it will grab whatever it finds as the first item.Yup.
That's also a horribly inefficient way of finding objects.
As tristaanogre, you need to make it more targeted and efficient.
I use a name map for the high level pages, containers, panels etc. Then small "helper" functions to find individual controls within them. That's my preference. And it works well enough for me.
- hhagay8 years agoContributor
Thank you Colin_McCrae. I agree that it is somewhat inefficient but I am trying to avoid name mapping all together.
tristaanogre has a good point to narrow the search while pointing to the label object. What is the best way (without name mapping) to find the label (Gender)?
Related Content
- 4 months agoD0UG
- 5 years agolingling_chiang
- 2 years agorkadali