Solved
Forum Discussion
HKosova
Alumni
9 years agoUPD: AlexKaras beat me to it. :)
If there are no other objects with IDs ending in "MenuInner", you can use wildcard search:
var mainMenu = page.FindChild("idStr", "*MenuInner", 10);
Since v. 11.2, Find methods also support regular expressions:
var mainMenu = page.FindChild("idStr", "regexp:^(main)|(nav)MenuInner$", 10);
A couple of notes:
- Use FindChild and not Find. Find starts searching from the parent object itself (in your example - page), FindChild skips the parent object.
- The fourth parameter of Find/FindChild is a boolean (Refresh=true/false) and not a number. Review the parameters to make sure they are correct.