A context menu is a top-level window and not a child of a Form or Windows application.
You can popup a context menu and select an item as follows:
Code: click into code to enlarge
// Click right mouse button
Mouse.ClickElement(element, MouseButtonType.RightButton);
// Wait 200msec
Application.Sleep(200);
// Select the context menu item with the name "Properties"
Application.PopupMenuSelectItem("Properties", 200);
or
Code: click into code to enlarge
// Click right mouse button
Mouse.ClickElement(element, MouseButtonType.RightButton);
// Wait 200msec
Application.Sleep(200);
// Select the context menu item with the name "Properties"
ContextMenu.SelectItemText("Properties");
A standard context menu has a class name: #32768, if you get the same, then the sample above will work.
If you get an other class name in RanorexSpy, then you should search the context menu with the Application.FindForm function.
Jenö
Ranorex Team |