Hi Team,
Please let me know which expression or activity should i use to know how many values present inside the drop down and also there total count.
Hi Team,
Please let me know which expression or activity should i use to know how many values present inside the drop down and also there total count.
You can use Get Attiribute activity to do this.
Make sure the variable type (items) is an array. Then you can find the number of values by items.Count
Regards.
Refer this.
Hey @tolga.kamci Thanks for your response.
Actually the attribute as ‘items’ is not showing in the activity.
After using find children activity it’s showing only 2 count only.
This could be due to the dropdown items are getting loaded dynamically while we one and scroll. Check if that’s the case.
In find children did you select descendants in scope?
Also can you show the selector of it
Cheers
The attribute with the name “items” is not offered in the Attribute dropdown (get Attribute Activity) but still is usable. Just enter it manually (respect letter cases)
Hey @Smitesh_Aher2,
To get the count of values in a drop-down (i.e., a Select element on a webpage) in UiPath, you can use the “Find Children” activity along with some expressions. Here’s how you can achieve this:
Use the “Find Children” Activity:
Scope
property to FindDescendants.Filter to Get Only Options:
"<webctrl tag='option' />"
Count the Drop-down Options:
dropDownCount = childrenList.Count
childrenList
is the output variable of type IEnumerable<UiElement>
from the “Find Children” activity.Example Workflow:
childrenList
dropDownCount = childrenList.Count
dropDownCount
will hold the total number of items in the drop-down.If the drop-down has a Select tag with a defined list of options:
Attribute
property to “innerhtml”."<option"
and get the count of items:dropDownCount = dropDownHtml.Split(New String() {"<option"}, StringSplitOptions.None).Length - 1
Hope this helps! Let me know if you need any more assistance.
Cheers!