Select the first Option in the Select item Activity

Hi Team,

How can i select the second Option in the select item acivity and please note it’s different every time.

@omar_ismail

  1. Use a “Get Attribute” activity to retrieve the options of the select element.
  2. Convert the attribute value into a list of strings (each representing an option).
  3. Use an “Assign” activity to set a variable to the first option in the list.
  4. Use a “Select Item” activity with the variable from step 4 as the input.

what should i write in the attribute to get the first Option

image

@omar_ismail

Try using different properties Like “Aaname” where you see the select item data.Store in a variable and perform operations on it to get the first element in that variable.and then simply pass it to select item

it turned out that the first choice is Choose and o need the one after this one so how can i get this one that the number end with 962

image

Hi @omar_ismail

How do I get uipath to select the first item of the drop down box? - Help - UiPath Community Forum

Please check this

Hi @omar_ismail

Check out the below thread. This will help you resolve your issue.

Regards

@omar_ismail ,

Follow below steps:

  1. Use Find Children activity con configure the filter as per your Dropdown control. It will return you output as IEnumerable<UiElement>.

  2. Use Select Item activity and pass outputVariable(0).Get(“innertext”).ToString as value.

Thanks,
Ashok :slight_smile:

Option: Find children

  • as mentioned by others above, then use the first option - uFoundChildren(0).Get(“innertext”).toString within the select item activity

Option: 2 clicks

  • first Click - expand the dropdown
  • second click - click on the first option - we handcraft the selector

Option: Select Attribute items first item usage

  • get attribute Activity - Selector to the select element, Attribute: items, variable: myItems | DataType: Object
  • Select Item Activity: DirectCast(myItems, String()).First()

and also few options / variations are possible as well
Assi

Hi @omar_ismail

To make it dynamic follow the below process,
→ Use the click activity and indicate on the dropdown to show the options in the dropdown.
→ Use for each Ui element activity and indicate the option in the dropdown. Output is CurrentElement.
→ Click on the Configure filter option in For each Ui element activity and select the endswith option in the dropdown and pass the “962” value in the field.

Check the below image for better understanding,

→ Inside for each insert the Click activity and pass the CurrentElement to the Input element option in the properties.

Check the below image,

By following the above steps weather the option which is ends with 962 at any position it will select in the dropdown.

Hope it helps!!

incorporating above into:

uFoundChildren.Where(Function (x) x.Get("innertext").toString.Trim.EndsWith("962")).FirstOrDefault
DirectCast(myItems, String()).Where(Function (x) x.Trim.EndsWith("962")).FirstOrDefault