how to select the multi level sub menu object
Can anybody please help me with the issue? Im stuck at a point selecting submenu within a submenu
Our desktop application has below Menu format:
I able to select till SubMenu2. How do I select SubMenuA and SubMenuB?
Thanks in Advance
Solved! Go to Solution.
The easiest way to find out how to select menu item, is to record your actions and then look at the code.
If you work with custom menu, it will be more difficult and require some skills to convert recorded actions into script code.
I am approaching a similar issue with web testing. I like the above answers, and may try them if mine does not work. However, my initial thought of how to handle my similar issue would be to use 'Conditional Mapping' within Name Mapping portion of TestComplete.
Hope you find solution that best works for you.
Your approach is working fine when i hardcode the values but while looping Im facing a problem. Then second level has only 4 submenus but on using the Submenu.count() while using for loop, it shows 6 in the count list. Any ideas?
In the above scenario, when you get submenu count for Submenu2 it will return 4 as it's direct sub submenu has childs.
Thanks for the quick reply. Your explanation makes sense if we are taking the count of child items of Submenu2. However in our application we have direct child items instead of child items for child items as in your example.
Below is the scenario in our application. The count for SubMenu5 shows 6 instead of 4. Count for Menu shows 5 though(excluding separators) It is similar to Windows Notepad application but with submenu for submenu.
I am able to select each of the options however "index out of bounds" error is thrown for index 5 and 6 which are not even present.
If you have already excluded separators, than it is possible that you have hidden menu items. You can navigate the menu using Object Spy (the MainMenu property) and examine every single menu item.