For a java application, I need to click a dynamic (specified in an argument) menu item that is 3 levels deep.
For example, I click the following 3 menu items to ultiimately click Railroads:
Industrials-> Road & Rail-> Railroads.
I use the Find Element to locate the Railroad menu item and set Found Element output variable.
But I cannot figure out how to click this menu item when running my workflow.
How can I find and click the menu item’s Parent menu (and it’s Parent menu) or is there a an alternate way to click a submenu item without knowing it’s multilevel hierarchical path?
Additional Info:
With a one level deep submenu, I use the Get Ancestor activity to locate the target menu item’s parent and then I use the click activity to click the parent menu item first, then I use another click activity to click the desired target menu item. But a multilevel menu item has multiple ancestors, and I have not figured out how to find each one.
@NIVED_NAMBIAR Thank you. The Set Focus does return the hierarchy of parents. Do I need to parse out the parent menu items and the target menu item. Do I need to iterate thru the parent menu items or is there another activity to simply click the final item?
No. Set Focus did not click the element. Since the item is 3 levels deep, I cannot even see that it is actually in focus, but since the Set Focus activity is working and shows the Element property with wall the menu levels, I guess it is working. For the Set focus, I put in some delay and and also a WaitForReady.COMPLETE but that did not help.
Does the UI Element need to be visible for the Set Focus to work?
My solution for clicking a submenu that is 3 (or more) levels deep is to iterate thru each hierarchy of the menu/submenu, clicking on the correct item in each level.
I accomplished this with the following workflow activities.
Attached to target window
Click Activity: On top level menu dropdown. This opens the list of top level menu items
Find Element Activity: Locates the target menu item. Output to varElement
For each item in varElement.Selector.getTags()
Assign menuItem = item.Tostring()
Click Activity with selector set to include the menuItem variable.
The Click Activity uses the following as its selector:
Note: I had to edit the Selector Property to get menuItem variable to be part of the selector. The Selector Editor would not allow me to add this variable. If I open the Selector Expression Editor, I see the warning message “Anchor based selectors are not supported in the Selection Editor”