How to select an item from drop down list based on index number?
Please advice
How to select an item from drop down list based on index number?
Please advice
Hello @subhashb6 and welcome to the community!
Could you post us the screenshot of your drop down list?
In the selector there is probably some index number, you could make this number dynamical and make his value depend on certain situations.
Hello @srdhan.suc
This is for a generic drop down. Not particular to my application. My requirement is to select 3rd/4th/nth item from that drop down list.
If needed refer screenshot attached.
Use select item command and give the value you want select
What may be a good idea is to select the drop down box then pass arrow key commands nth times to navigate down the list, but first make sure the process starts at the top of the menu.
I tested this myself and you can select the first box, click the arrow keys nth times, then press Tab to go to the next drop down box. This will work pretty fast as well.
Other than that if you know where to start or what you want to select use “Set Focus” and “Type Into” (I like to use them together for accuracy sometimes) or “Select Item”, but make sure both are strings.
-K
I want to select the item based on position (index) of the item in drop down list. Not by value
Btw, there is no index number property present for Select Item activity
Though this worked, I don’t feel it as a reliable solution as sending key strokes sometimes fails during execution
If there is a better solution, unfortunately I am not sure of it. Another option is to use the Full Text screen scraping, put those values into a datatable, then reference the row by index. That will work as well and most likely be more precise. I just tested it and it seems to work fairly well.
This works because using Full Text for screen scraping gathers hidden information contained in the element as well, so instead of getting just the visible value, it will get all of the values.
Scrape the value, generate a datatable from it, then you can reference the row
Does the values in the drop down constant or changing from record to record?
Constant
test4.xaml (10.1 KB)
Get the list of items on the list passed as an string
then call them using string[10-1] for the 10th item of the array ect.
See attached.