Forum Discussion

r_ahmakov's avatar
r_ahmakov
Occasional Contributor
9 years ago

Find Menu Items by name and not by index

Hi,

 

I am trying to access menu items by names and not by index. For example w.MainMenu.Click("File|Open...") does not work, but w.MainMenu.Click("File|[1]") works fine. Why TestComplete does not recognize SubMenu Items by their names?

 

Thanks

  • What type of menu? There are many. They don't all behave the same.

     

    Web? Desktop? Language used? Class of the control? You don't give much info ....

  • r_ahmakov's avatar
    r_ahmakov
    Occasional Contributor

    sorry...

     

    The tested program is in delphi language and the menu is VCL.Menu.TMainMenu.

    • Colin_McCrae's avatar
      Colin_McCrae
      Community Hero

      Ah OK.

       

      Hold on. I'm working on a Delphi app at the moment. But I don't have to use any menu bars. It's all tool bars in mine. (There are menu bars there though I think .... I just don't need to use them. Soon find out!)

       

      I'll go have a look ....

      • Colin_McCrae's avatar
        Colin_McCrae
        Community Hero

        You're out of luck I'm afraid.

         

        All the strip menu's are in .NET parts of the application. (it's a mixture of .NET which launches Delphi EXE's - I'm working on testing the Delphi parts)

         

        But my guess would be that the option names WILL be stored as a property somewhere. (Or possibly in the "Fields" info? A couple of Delphi controls have required me to dip in there as no property value was suitable or accurate.) You may need debug info enabled to expose it though. Hard to say without seeing one.

         

        So in other words, you use the area where the option text is stored to work out the index numbers. Then use those calculated numbers to make your selection.