Forum Discussion

ErikLarson's avatar
ErikLarson
Contributor
5 months ago

Unable to access popup menu from MFC Ribbon Dropdown button

I have tried everything I can think of to access the dropdown menu for this ribbon button, and I keep coming up short. Hoping someone here can assist me with this.

Our application has a "program options" button that opens a rather long context menu. 6 of the items in that context menu have sub-menus that open. I need to be able to select an item from one of those sub-menus during a test.

I tried:

The first line correctly selects the ribbon panel containing the button we need, the second one clicks that button and the popup menu appears on the screen. The playback then sits for a few seconds with a message about waiting for the menu, and then fails with an error message "Popup menu was not found" the target for this "PopupMenu" line is set to the button that I clicked to open the popup menu, which according to everything I can find in SmartBear documentation should be correct. I have tried setting it to the button, the panel the button is in, the ribbon bar, and the application, and I get the same result -- the menu cannot be found.

Anyone have any idea what I should try next?

37 Replies

    • ErikLarson's avatar
      ErikLarson
      Contributor

      I already have MSAA enabled in project settings. Before enabling MSAA I was not able to select the individual buttons or pieces of the ribbon control. Now I am able to select the options button and click it to open it's popup menu, but I have so far not been able to interact with that popup menu.

    • ErikLarson's avatar
      ErikLarson
      Contributor

      I don't think we have that add on available. Is there a way to do this without that?

  • rraghvani's avatar
    rraghvani
    Icon for Champion Level 3 rankChampion Level 3

    I'm able to access the following menu New Items -> More Items -> Task Request using the following key word actions, against the ribbon bar in Outlook 365

    TestComplete might be recording the actions incorrectly for you - I suggest you remove PopupMenu and replace it with something similar to what is shown in the above image. Just to see if it works for you.

    • ErikLarson's avatar
      ErikLarson
      Contributor

      I think if it recorded the windows correctly I might be able to do something like that. It shows the popup menu button as:
      Aliases.<Program>.<main window>.RibbonBar.<client window area of ribbon>.toolbarX.toolbarY.DropDownButton

      And the popup menus (no matter which button popped them up) themselves are shown as:
      Aliases.<Program>.wndAfx.Item

      If I do record and then click on the help popup menu, then go click on another popup menu button, the system recognizes BOTH popup menus as Aliases.<Program>.wndAfx.Item

      So it is like it cannot differentiate between them. I can automate buttons on the ribbons with no problems, but once one of these menus opens, I cannot do anything.

      I have been banging my head against the wall trying to find a solution for this for the past month, and so far I cannot find any way to get it to recognize the menus correctly. I cannot test on office products, I don't have office installed on the testing environment computer.

      • rraghvani's avatar
        rraghvani
        Icon for Champion Level 3 rankChampion Level 3

        If your application is well developed for automation, where each UI controls has unique ID’s, then TestComplete will correctly identify and create suitable mapped objects. However in certain instance, like you have just experienced, where TestComplete can not differentiate between UI controls. You will have to manually create the mapped object, and include suitable unique properties.

        If you haven’t done so already, read through https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/index.html and then refer to Adding objects to the Name Mapping repository -> Manually.

        Let me know how you get on.

  • And yes, definately C++/MFC  and not .Net. The main class in the C++ code is CMFCRibbonBar.

    • rraghvani's avatar
      rraghvani
      Icon for Champion Level 3 rankChampion Level 3

      Can you verify your application is fully supported based on the information given here Supported Development Tools | TestComplete Documentation

      Also see Desktop Application Testing | TestComplete Documentation - you might need to do some pre-requirement setups first, and Object Identification | TestComplete Documentation. See https://support.smartbear.com/testcomplete/docs/app-testing/desktop/missing-debug-info-message.html 

      I suggest you create a new project, and try and get TestComplete to identify individual UI controls in your application first. Switch between enabling and disabling MSAA/UI Automation *, and switch to Advance View, and not Basic View.

      Enable or disable this only, and to not add items to this list

      This is to ensure and verify TestComplete can support your application.

    • rraghvani's avatar
      rraghvani
      Icon for Champion Level 3 rankChampion Level 3

      I've created a MFC application which uses CMFCRibbonBar, and I'm also struggling to capture the sub-menu items, as it keeps getting destroyed when it loses focus while clicking on Object Spy. So I'm not able to query any of the Params.

      This is a lot difficult than the WPF application!

      Would you be able to open a support ticket via https://support.smartbear.com/testcomplete/message/ and hopefully, their support team should be able to come up with a possible solution.

      • ErikLarson's avatar
        ErikLarson
        Contributor

        I opened a support ticket with SmartBear, I sent them my test application that has nested menus in it and a video showing what the problem is. Here is the response I got back so far:

        Monday, August 18, 2025:

        Thank you for your patience. 

        I wanted to follow up here to inform you I was able to start up RibbonsTester1 and confirmed I was able to reproduce the issue. I will update you here on my findings. Thanks again. 

        Hopefully they can find a solution..