@RobotKeyword("Gets item names from the components context popup menu.\n" + "Does a right click on the component and retrieves the specified menu items from the popup menu.\n\n" + "Example:\n" + "| @{items}= | `Get Menu Items From Popup Menu` | myComponent | Actions |\n" + "| `Should Contain` | ${items} | Do something |") @ArgumentNames({ "identifier", "menuPath" }) public List<String> getMenuItemsFromPopupMenu(final String identifier, final String menuPath) { JPopupMenuOperator popup = operator(identifier).invokePopup(); if (menuPath == null || "".equals(menuPath)) { return ComponentUtils.getParsedElements(popup.getSubElements()); } JMenuItemOperator subItem = popup.showMenuItem(menuPath); return subItem.getSubElements().length < 1 ? new ArrayList<String>() : ComponentUtils.getParsedElements(subItem.getSubElements()[0].getSubElements()); }
@RobotKeyword("Gets item names from the node context popup menu.\n" + "Clears earlier selections.\n" + "If several nodes have the same path then *only the first* menu item names of those nodes are returned.\n\n" + "Example:\n" + "| @{items}= | `Get Node Items From Tree Popup Menu` | myTree | Root|Folder | Actions |\n" + "| `Should Contain` | ${items} | Do something |") @ArgumentNames({"identifier", "nodeIdentifier", "menuPath"}) public List<String> getNodeItemsFromTreePopupMenu(String identifier, String nodeIdentifier, String menuPath) { JPopupMenuOperator popupMenuOperator = treeOperator(identifier).createPopupOperator(nodeIdentifier); if (menuPath == null || menuPath.isEmpty()) { return ComponentUtils.getParsedElements(popupMenuOperator.getSubElements()); } else { JMenuItemOperator subItem = popupMenuOperator.showMenuItem(menuPath); return subItem.getSubElements().length < 1 ? new ArrayList<String>() : ComponentUtils.getParsedElements(subItem.getSubElements()[0].getSubElements()); } }