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.