Unable to access popup menu from MFC Ribbon Dropdown button

Originally posted by ErikLarson on April 11, 2025

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?

Originally posted by rraghvani on April 11, 2025

Have a look at my answer in post Outlook 365 automation | SmartBear Community. You might need to enable MSAA in Project Settings.

Originally posted by ErikLarson on April 11, 2025

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.

Originally posted by caitlinrich on April 11, 2025

Hi Erik,

If you have the Intelligent Quality Add-On, this may be a good spot to use an OCR Action. It will be able to recognize the text you’re looking for and interact with it accordingly.

Originally posted by ErikLarson on April 11, 2025

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

Originally posted by rraghvani on April 14, 2025

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.

Originally posted by ErikLarson on May 05, 2025

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...RibbonBar..toolbarX.toolbarY.DropDownButton

And the popup menus (no matter which button popped them up) themselves are shown as:
Aliases..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..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.

Originally posted by rraghvani on May 06, 2025

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.

Originally posted by ErikLarson on May 06, 2025

I’m still having difficulty. I cannot map these objects (or haven’t figured out how) because they disappear from the screen when I click on the TestComplete window. The only way I can get them mapped is to have the record function do it, and then they all have the same reference in the software. It is as if MFC is re-using the ID for each of these popups it makes, which is very frustrating. It is out of my control, as they are made from within the button in the MFC ribbon control.

Here is a screenshot showing my MSAA being turned on. I have tried adding the separate pieces (Afx:RibbonBar:400000*, Afx:DockPane:400000*, etc..), and that hasn’t made much difference.

I do notice that when I am recording a test and click on the drop down button an then on the menu I get a message about “Missing Debug Info” - The screenshot drew the red line over it, but it says “The control cannot be recorded properly, because no debug symbols were found for it.” I again get that message as a popup message when I click stop on the record action. I’m thinking that id I could solve that one it might also help. I do have the .pdb file created by the compiler when our program is made in the directory with the tested application, as well as the MFC140u.pdb and MFC140ud.pdb files. I don’t know what more to do to help it recognize things.

This is what it puts in my test script:

And it fails on the click action for “Item” with a message saying “Unable to find the object “Item” See details for additional information”

The object with the specified attributes does not exist.

Tested Object:
Aliased.Program.ProgramOptionsMenu
(Sys.Process(“”).Window(“Afx:00400000:800:00010003:00000010:00000000”,“”,4))

It clicks on the menu dropdown button, but then fails to open the sub-menu to click on the item in the sub-menu. Which is why it is saying the object doesn’t exist, it doesn’t because the tester did not open the sub-menu before trying to select an item in it.

I am going to attach a sample program that has similar menus - look at the test menus button on the ribbon. These wind up behaving the same in TestComplete as the ones in our real program, and I cannot select them.

Originally posted by rraghvani on May 07, 2025

Are you able to get your developers to refer to https://support.smartbear.com/testcomplete/docs/app-testing/index.html ? There’s information on how to expose controls of an application.

You can use the Object Browser to create name mappings,

You also need to refer to your Mapped Objects repository, not Aliases.

Question. How familiar are you with TestComplete?

Originally posted by ErikLarson on May 08, 2025

I am not super familiar with TestOut. I was given the task of updating all our testing in TestComplete a few months ago when we made changes to the UI of the software. I am one of the developers. I have looked over that link you sent, and the settings have already been made in our software when we compile it from C++.

I was able to access anything we needed before we updated the software to use MFC Ribbon controls. Now I cannot access many of the menus and the errors keep piling up like I have mentioned. I would love to map the menus I am trying to get to, but I cannot find them in the object browser because they do not stay on the screen so when the object browser refreshes, they are not there for it to see.

Originally posted by Hassan_Ballan on May 08, 2025

Have you tried exploring the application using TestComplete Object Spy
https://support.smartbear.com/testcomplete/docs/testing-with/exploring-apps/index.html
https://support.smartbear.com/testcomplete/docs/testing-with/exploring-apps/object-spy/index.html
“Point and fix” feature
https://support.smartbear.com/testcomplete/docs/testing-with/exploring-apps/selecting-objects-using-cursor.html
to view each object properties and methods in “Basic View” as well as “Advanced View”?

You probably can manually adjust identification Mapping Criteria https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/basic-mapping-criteria.html

Originally posted by ErikLarson on May 08, 2025

I have done some exploring that way, and will try to do so with these menus and see what happens.

Originally posted by rraghvani on May 09, 2025

I’m not sure what TestOut is!?

One of the most important things in TestComplete is Object Identification. If record and playback doesn’t map the objects correctly, like in this case, then you have to manually map the objects. It’s a faff to do, but it does work.

Are you able to provide a small application with the ribbon bar?

Originally posted by ErikLarson on August 06, 2025

I’m sorry, I typed TestOut when I meant TestComplete..

I have come back to this project, and am still just as stuck as I was before. I can get TestComplete to click on the dropdown button in the ribbon bar, and then the popup menu appears. Using the “add object” in name mapping and then using the “point and fix” mode, I have been able to map the popup menu in TestComplete. When the menu was highlighted with the red border, I press CTRL-SHIFT-A and then TestComplete mapped two items.

The first is a child of the tested application, with the following attributes:
WndClass : Afx:00400000:800:00010003:00000010:00000000
Index : 1
ClassName: CMFCRibbonPanelMenu
ObjectType: Popup

The second is a child of the first, The only child of the first, and has the following attributes:
WndClass : Afx:ToolBar:400000:8:10003:10
ClassName: CMFCRibbonPanelMenuBar

A google search for the two class names (CMFCRibbonPanelMenu and CMFCRibbonPanelMenuBar) returned a Microsoft page that told me they were internal classes to MFC. (link to that page is here: Internal Classes | Microsoft Learn).

I can click on items in the popup menu by using on screen action Click and passing X,Y coordinates relative to the popup menu with the target being the second object (the CMFCRibbonPanelMenuBar), and TestComplete will click on the corresponding menu item. I have not been able to do anything beyond this, however. I need to be able to check to see if something is already checked before clicking on it, and have so far been unable to determine how to do this.

The CMFCRibbonPanelMenuBar item does expose a ClickItem() function to TestComplete, but I have not been able to get it to click any items. It always fails with “The toolbar item ‘’ not found.”

Any help figuring this out would be appreciated.

Originally posted by rraghvani on August 06, 2025

Have you seen the example that I had provided, where I am using Click?

Originally posted by ErikLarson on August 06, 2025

I am not sure what you are referring to.

Originally posted by ErikLarson on August 06, 2025

If you meant the one about the ribbon bar in O365, yes. That is the only way I am able to interact with this menu is with the Click action. I need to also be able to check to see if the item needs to be clicked (it will have a checkmark next to it if it has already been clicked), and I am still having issues clicking on any sub-menu item.. But I am trying to get the main menu working correctly before I tackle any sub-menu.

Originally posted by rraghvani on August 06, 2025

Without screenshots, name mappings, object browser etc it’s difficult to provide assistance.

It’s vital to get the name mappings correctly defined, so that TestComplete can identify the correct UI controls, you want interact with.

Originally posted by Hassan_Ballan on August 06, 2025

Have you also tried viewing details in the “Object Browser” https://support.smartbear.com/testcomplete/docs/testing-with/exploring-apps/object-browser/index.html

As it is difficult to figure out, perhaps you can investigate a different approach to navigate such as using keyboard rather than mouse.

TestComplete provides the Keys method to simulate keystrokes, allowing automation of keyboard input in tested applications. This method can be used in both keyword tests and scripts https://support.smartbear.com/testcomplete/docs/reference/program-objects/ocrtextblock/sendkeys.html

The check to see if something is already checked is another hurdle.

:speech_balloon: Found the answer helpful? Give it a Kudos by clicking Like!
:white_check_mark: Got your issue resolved? Click Mark as Solution so others can find it quickly.