Forum Discussion

randall's avatar
randall
Contributor
7 years ago

Issues accessing menu items in an MFC based application

In my application being tested I have been able to access the menus on the menu bar via the following name mapping:

 

Aliases.TrussStudioProcess.LayoutFrame.TopDockBar.LayoutMenuBar

 

I can access the menu using index numbers like this:

 

Aliases.TrussStudioProcess.LayoutFrame.TopDockBar.LayoutMenuBar.ClickItem(0, true);

 

In this example the File menu, which is the first menu on the left, is clicked and opened.

 

The problem I am having is that the menu will not stay open so I can name map it.  If I record selecting something off of a menu TestComplete maps the menu item list to 'Item'.  So I am only able to script the opening of a menu but not the selection of an item on the displayed list.

 

How do I get the menus to stay open long enough so that I can name map them to names like FileMenuList, ApplicationMenuList, etc.?  I am using JavaScript if that makes a difference in the answer.

 

I have already tried everything in the 'Addressing Menu Items' article in the Help section for Desktop testing and was unable to get anything suggested to work.

 

5 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    When you bring up the tool to map the object, there's an option to use CTRL-SHIFT-A to allow map what's under the cursor.

    • randall's avatar
      randall
      Contributor

      Robert,

       

      Once I figured out how to access the 'context' menu in the Object Spy application and select 'Map Object', the Map Object dialog initially told me I had to map an unmapped parent object.  The problem is that the parent object is already mapped and when I click 'Yes' on the dialog to map it I get an error telling me the object I want to map is not visible.  While this is certainly true for the menu display list I am trying to map it is not true of the parent object.  When I click the 'OK' button on the error dialog the whole process exits and I am stuck back at the beginning again.

       

      Randall