MenuItem theItem = null;
// try three times to get the menu item
for (int i = 0; i < 3; i++) {
Control control = (Control) bot.widget;
// for dynamic menus, we need to issue this event
control.notifyListeners(SWT.MenuDetect, new Event());
Menu menu = control.getMenu();
for (String text : texts) {
Matcher<?> matcher = allOf(instanceOf(MenuItem.class),
withMnemonic(text));
theItem = show(menu, matcher);