Forum Discussion

Sreera's avatar
Sreera
Occasional Contributor
7 years ago

how to select the multi level sub menu object

Hi all,

 

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:

 

 Main Menu

   SubMenu1

   SubMenu2

           SubMenuA

           SubMenuB

   SubMenu3

 

I able to select till SubMenu2. How do I select SubMenuA and SubMenuB?

 

Thanks in Advance

  • If the menu is normal and standard menu then you can click by using below lin.

     

    MenubarObject.Click(MainMenu|SubMenu2|SubMenuA);
  • karkadil's avatar
    karkadil
    Valued Contributor

    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.

  • shankar_r's avatar
    shankar_r
    Community Hero

    If the menu is normal and standard menu then you can click by using below lin.

     

    MenubarObject.Click(MainMenu|SubMenu2|SubMenuA);
    • Sreera's avatar
      Sreera
      Occasional Contributor

      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?

      • shankar_r's avatar
        shankar_r
        Community Hero
        1. Menu
          1. Submenu1
          2. Submenu2
            1. item1
            2. item2
              1. subitem1
              2. subitem2

        In the above scenario, when you get submenu count for Submenu2  it will return 4 as it's direct sub submenu has childs.

         

         

  • CFQA's avatar
    CFQA
    New Contributor

    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. 

     

    Conditional Mapping

     

    Hope you find solution that best works for you.