Based on the shared details I assume that toggling the dropdown triggers the appearance of the list with items in the DOM tree. Probably this is a HTMLUnorderedList
which items can be easily accessed and used in a foreach
statement should be built similarly to the example how to iterate through each grid cell
Please keep in mind that if the list appears dynamically in the DOM tree, you will need to refresh that in the code as well. That way you will ensure that the Testing Framework has its latest state.
I hope the above helps. Still, if it doesn't. or the information is insufficient to find the proper solution, please prepare a sample test against an accessible page to demonstrate what difficulties you are facing.