Forum Discussion
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.
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)?
- tristaanogre8 years agoEsteemed Contributor
Well, without knowing exactly how the "Gender" panel shows up in the object browser, hard to give you specifics. My assumption is that "Gender" is in the innerText of a "div" panel. So, I'd do a FindChild to look for the container with that innerText (perhaps other properties as well to make sure you get the right one). Then, from that container, do your FindChild to get your "Select" control. It's two searches rather than one.
And see, that's where NameMapping give you the benefit. The two searches are going to take time, reducing performance of your overall test. NameMapping will give you improved performance if done correctly because the "search" that NameMapping does is in the compiled code of TestComplete and not in the interpreted code of your script. If you are adamently against NameMapping, then two FindChild calls it is.
Related Content
- 4 months agoD0UG
- 5 years agolingling_chiang
- 2 years agorkadali
Recent Discussions
Check PopupMenu exists
Solved37 minutes agomfoster711- 23 hours agosimonaferrara
- 2 days agomacheshmeh