In the Select item activity i have duplicate name in the list… i have try to Select “Business Unit” first one… at the time debug the code its choose second one… how set first one in the select item.
First Business Unit xpath : //[@id=“filters_grp_company”]/optgroup[2]/option[5]
Second Busines Unit xpath : //[@id=“filters_grp_company”]/optgroup[3]/option[5]
To select the first “Business Unit” option in the Select Item activity when there are duplicate names in the list, you can modify your selector to be more specific, targeting the first option explicitly.
In UiPath, you can use the “idx” attribute to specify the index of the element within a collection. Here’s how you can modify your selector to target the first “Business Unit” option:
If the child elements are static try using dynamic click, which means click on the drop down first-> then click on the ( First Business Unit xpath : [@id=“filters_grp_company”]/optgroup[2]/option[5] ) using another click selectors.
Try simulate properties if it works or else go with default(Hardware events)
when working with the select item we can modify the selector pointing to the select element (the dropdown). But influence the item selection is for us behind the scenes.
As alternate pattern we can do:
click1 - expand the drop down
click2 - elect the option
so for click 2 we can fine tune the selector
When some precalculations are to be done in advance we can use find children and getting all options on advance.
we would assume that on html element level there will be 2 different value attributes for a further differentation
click select employees option dropdown box will be appear… In that dropdown i have to choose the first Business unit try to indicate the on three methods AA, UIA, and Default its showing above image i shared
Final Goal : i want to select first Business unit in the dropdown list