Forum Discussion

svinja's avatar
13 years ago

Possible bug in TC 9.20 using MFC

Reproduction steps:



1. Create the default MFC MDI project in Visual Studio 2012

2. Add 2 or more submenus to the IDR_POPUP_EXPLORER menu (the easiest way is to use the resource editor)

3. Look at this popup menu in TestComplete (for example, by iterating over and printing out its wButtonText collection)



Result:



Every submenu has wButtonText value equal to the value of the first submenu! If your menu is (top to bottom):



Option1, Option2, Submenu1, Option3, Submenu2, Submenu3, Option4



TestComplete will actually show:



Option1, Option2, Submenu1, Option3, Submenu1, Submenu1, Option4!



For this reason, it is not possible to click the submenus by name.



What is a good workaround for this, assuming the menu content isn't known ahead of time (can't use keyboard arrows, menuitem indices, etc)? I can even modify the application source slightly if necessary.



So far, my idea is to recursively seek possible matches for a sequence of clicks such as "SubmenuA\SubmenuB\OptionC" (if Submenu is found, click it, if it isn't found, recurse into clicking each entry that is repeated multiple times in the menu) but this will fail if there are multiple submenus at the same depth level that all have OptionC with the same wButtonText - if I want to click SubmenuFoo\OptionX it is impossible to differentiate between SubmenuBar\OptionX and the exact same SubmenuBar\OptionX (one of which should actually be SubmenuFoo\OptionX, but isn't due to the bug). So I am looking for a better way.

No RepliesBe the first to reply