Showing results for 
Search instead for 
Did you mean: 

ContextMenuStrip click action doesn't work


ContextMenuStrip click action doesn't work

I've got an issue on my desktop app; the click on a sub-menu belonging to the class ContextMenuStrip doesn't work.
I'll try to give you some information, but ask me if you need other details.
The issue is related to a menu that is displayed after doing a right-click on a treeView.
As example, this is the structure :


      |_ Child3

         |_ Child4
If the Child4 is right-clicked, a submenu (it belongs to ContextMenuStrip class) appears, with the following structure:
- New
- Delete
- Update
Then, if the New item is clicked (or on mouse over), another menu appears (it belongs to ToolStripDropDownMenu class) and I want, at the end, to click on one element of this menu.

The actual code correctly executes the right-click, but then it stops, with an error when it has to click on the first submenu (on New item for example).
I've tried to record it and this is the generated code (VBScript):


Sub Test1
  Dim EDashBoard
  Dim tabControl
  Set EDashBoard = Aliases.EDashBoard
  Set tabControl = EDashBoard.HwndSource_ribbonwindow.WinFormsAdapter.SystemConfiguratorMainForm.toolStripContainer1.ToolStripContentPanel.splitContainer1.SplitterPanel2.splitContainer2.SplitterPanel.tcMain
  Call tabControl.ClickTab("Parent")
  Call tabControl.tabSystemSettings.SystemExplorerWrapperOne.seDB.trvProject.ClickItemR("|Parent|Child1|Child2|Child3|Child4")
  Call EDashBoard.ContextMenuStrip.Click(40, 19)
  Call EDashBoard.ToolStripDropDownMenu.Click(85, 127)
End Sub


But later if I execute the recorded test, it doesn't work.
This is the error generated: "The object "ContextMenuStrip" does not exist" and t
he error appears on ContextMenuStrip.Click row.


I've tried to click it using both the FullName or the Alias into the code (and not the recorded code), but it doesn't work.

Morever, I cannot find the object by Id because it seems a dynamic object (the Id changes every time the menu is opened).


The strange thing is that: if I use the Object Spy with Point and Fix and try to open it into the Object Tree, the following error appear "Unable to highlight this object tree, because it does not exist".


Do you have any idea to solve this issue?




Community Hero

Re: ContextMenuStrip click action doesn't work

Try recording a test where you follow those menus and look at how TestComplete is seeing them.  That should give you a clue as to how the name mapping needs to be updated.

Community Hero

Re: ContextMenuStrip click action doesn't work

Hi Simona,


Can you let us know how ContextMenuStrip and ToolStripDropDownMenu are NameMapped?


  /Alex [Community Hero]
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.

Re: ContextMenuStrip click action doesn't work



the MappedName property values for the two objects are the following:








Re: ContextMenuStrip click action doesn't work

Hi Marsha,


how can I understand if name mapping must be updated? 

I found that the ContextMenuStrip exixts into NameMapping, and no other object have the same FullClassName.

New Here?
Join us and watch the welcome video:
Top Kudoed Authors