How to get a count of all the values in a particular dropdown

Hi,

I want to click on a random value in a dropdown and the solution in How to Get Select Option Value? will work but I want to get the count of all values in a dropdown so that I can use it as the end value in the range.

Is there a way to get the count of values in a dropdown, because the number of values in the dropdown are not constant.

Thanks
Sravani

Hi @sravani,

  1. Get a locator for the first option in the dropdown menu (example - //main/div[2]//a[1]).

  1. Use the ‘Count Elements’ action to count the amount of elements in the dropdown menu by removing the specific option value (example - //main/div[2]//a).

1 Like

Thank you so much for the solution it worked.

@sravani You are very welcome :slight_smile: