Forum Discussion
TestComplete provides access to popup menu objects.
Have you tried below,
- Aliases.CrewWare.HwndSource_PopupRoot.PopupRoot.Click("<ITem name or Index>")
- Aliases.MyApp.HwndSource_mainWindow.mainWindow.tabControl1.listBoxDevices.Items(0).Popup.Clcik("<ITem name or Index>")
- If you are not able to find a solution with above two steps then try to record the action and see how TestComplete clicks. You will find a idea here.
Still you are not able to resolve prove some snapshots of Object properties etc.
The recorded action converted to the following steps:
Aliases.CrewWare.HwndSource_PopupRoot.PopupRoot.Click(58, 105)
Aliases.CrewWare.HwndSource_PopupRoot.PopupRoot.Click(68, 11)
Aliases.CrewWare.HwndSource_PopupRoot.PopupRoot.Click(64, 15)
The image snapshots for each step above showed the correct submenu, but when run, all of the clicks occured in the first-level menu, not the submenus. Additionally, these are still based on relative X,Y coordinates of the object. I would like to access the menu items by name, header, or possibly even a tag in the WPF object.
The TC Click Action accepts X,Y coordinates, so name or index will not work as parameters there.
Others report success using FindChild, but I have not been able to get FindChild to return the menu item object.
The object returned by Point and Fix object:
Aliases.CrewWare.HwndSource_PopupRoot.PopupRoot.WPFObject("Decorator", "", 1).WPFObject("NonLogicalAdornerDecorator", "", 1)
I'm thinking I need to poke around this object somehow.
- RandyJ51507 years agoOccasional Contributor
Poking around the Aliases.CrewWare.HwndSource_PopupRoot.PopupRoot.WPFObject("Decorator", "", 1).WPFObject("NonLogicalAdornerDecorator", "", 1) object has been enlightening, but I cannot figure out how to access the menu items by name. I know this has been solved because I see other solutions. Can someone help me understand what I'm working with?
While poking around, I did write the following snippet and received the following results. Am I barking up the right tree or pursuing a futile course of action? Can someone explain what these object are?
Script:
# Attempting to figure out how to access context menu items by names, so far unsuccessful
arrayproperties=["ClrClassName"]
arrayvalues=["*"]
something = Aliases.CrewWare.HwndSource_PopupRoot.PopupRoot.FindAll(arrayproperties, arrayvalues, 100, True)
for x in range(len(something)):
Log.Message("something[" + str(x) + "]" + something[x].ClrClassName + ", " + something[x].Name)
somethingelse = something[x].FindAll(arrayproperties, arrayvalues, 100, True)
for y in range(len(somethingelse)):
Log.Message("somethingelse[" + str(y) + "]" + somethingelse[y].ClrClassName + ", " + somethingelse[y].Name)Output:
something[0]PopupRoot, WPFObject("PopupRoot", "", 1)
somethingelse[0]PopupRoot, WPFObject("PopupRoot", "", 1)
somethingelse[1]Decorator, WPFObject("Decorator", "", 1)
somethingelse[2]NonLogicalAdornerDecorator, WPFObject("NonLogicalAdornerDecorator", "", 1)
somethingelse[3]AdornerLayer, WPFObject("AdornerLayer", "", 2)
somethingelse[4]AdornerLayer, WPFObject("AdornerLayer", "", 1)
something[1]Decorator, WPFObject("Decorator", "", 1)
somethingelse[0]Decorator, WPFObject("Decorator", "", 1)
somethingelse[1]NonLogicalAdornerDecorator, WPFObject("NonLogicalAdornerDecorator", "", 1)
somethingelse[2]AdornerLayer, WPFObject("AdornerLayer", "", 2)
somethingelse[3]AdornerLayer, WPFObject("AdornerLayer", "", 1)
something[2]NonLogicalAdornerDecorator, WPFObject("NonLogicalAdornerDecorator", "", 1)
somethingelse[0]NonLogicalAdornerDecorator, WPFObject("NonLogicalAdornerDecorator", "", 1)
somethingelse[1]AdornerLayer, WPFObject("AdornerLayer", "", 2)
somethingelse[2]AdornerLayer, WPFObject("AdornerLayer", "", 1)
something[3]AdornerLayer, WPFObject("AdornerLayer", "", 2)
somethingelse[0]AdornerLayer, WPFObject("AdornerLayer", "", 2)
something[4]AdornerLayer, WPFObject("AdornerLayer", "", 1)
somethingelse[0]AdornerLayer, WPFObject("AdornerLayer", "", 1)- RandyJ51507 years agoOccasional Contributor
No solution found on how to access context menu items by Name or by Header name.
- brohrbacher6 years agoOccasional Contributor
Did you ever get the items in the Context menu to work based on their names? Having the same issue right now.
Related Content
- 11 years ago
- 4 years ago
Recent Discussions
- 19 hours ago