How to get a context menu which is outside the apl window

Jul 22, 2010 at 4:12 AM


I have a context menu which is outside the application window. I am using the automation element object to handle that. (I am parsing through desktop)

Is there any way that i can handle that using white uiitems object?


Jul 22, 2010 at 7:42 PM
Hi WinForm or WPF? Throndorin
Jul 26, 2010 at 7:44 AM


Jul 26, 2010 at 7:55 AM
Edited Jul 26, 2010 at 7:56 AM

Have you tried something like this:



Application app = Applicaion.Lunch("myApp");

Window main = app.GetWindow("MyApp");

PopUpMenu menu = main.Popup;





Menu  menu = main.PopUpMenu(params string[] path);


use main.HasPopup to be sure Context Menu is open.


Hope that helps





Jul 27, 2010 at 11:25 AM

No that is the problem, actually the menu is outside the application window, that is in the object browser the menu object is at same level as window.

Not a child of that window.

So if i use main.popup the menu object cannot be found.

Jul 27, 2010 at 12:30 PM
Edited Jul 28, 2010 at 6:10 AM


ok if it is ok that you get the Automation Element from Desktop than you can try to make UIItem from the Context Menu


UIItem and class which inherit from it has a constructor like


UIItem item = new UIItem(AutomationElement element, ActionListener listener);


try to use your AutomationElement and the ActionListener from your Application Window to generate the correct UIItem (MenuBar or Menu)


I have never tried it for Elements from Desktop but this is my first guess.