Ask a Question

Issues accessing menu items in an MFC based application

randall
Contributor

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 5
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.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

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

tristaanogre
Esteemed Contributor

What you described is object browser... not object spy....


https://support.smartbear.com/testcomplete/docs/testing-with/exploring-apps/object-spy/about.html


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

No, I am pretty sure I am referring to the Object Spy.  I invoke it from the following toolbar:

 

ObjectSpyToolbar.png

 

I click on the second button from the left.  And when I hover my mouse cursor over it the tooltip says 'Display Object Spy'.

 

 

tristaanogre
Esteemed Contributor

OK.... there's a tool option up there as well for mapping a component.  Use that.  When you do so, there's a similar option for SHIFT-CTRL-A.  You can use that to capture components that don't stay "static" on screen for standard mapping.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
cancel
Showing results for 
Search instead for 
Did you mean: