Use of “storeSelectedIndex” and “storeSelectedIndexes” command in selenium IDE

Last updated on October 8th, 2025 at 11:36 am

“storeSelectedIndex” Command

storeSelectedIndex works with only select or multi-select target element like drop down and list box. Using this command, you can get option index of selected option.

New Test
CommandTargetValue
storeSelectedIndexctrl5_Main_ddlStateindexno
echo${indexno}
storeSelectedIndexesctrl5_Main_ddlStateindexnos
echo${indexnos}

(Note : Click here to view examples of other store commands.)

In above example, ctrl5_Main_ddlState target element is list box.Here command “storeSelectedIndex” will store index value of current selected option of target element ctrl5_Main_ddlState list box into variable “indexno”. We can also use this command with any drop down. We can use “storeSelectedIndex ” if there is

selected only one option from list box. If there are multi selected option into target element then we have to use storeSelectedIndexes command

“storeSelectedIndexes” Command
Same as “storeSelectedIndex” command, “storeSelectedIndexes” command will be used with drop down or list box to get index value of multiple selected options. In above example, “storeSelectedIndexes” command will store index of all selected options of element “ctrl5_Main_ddlState” into variable “indexnos”. we can use “echo” for seeing stored values into given variable.
author avatar
Aravind QA Automation Engineer & Technical Blogger
Aravind is a QA Automation Engineer and technical blogger specializing in Playwright, Selenium, and AI in software testing. He shares practical tutorials to help QA professionals improve their automation skills.
Stay Updated with New Articles
Get the latest tutorials and insights delivered to your inbox.

4 thoughts on “Use of “storeSelectedIndex” and “storeSelectedIndexes” command in selenium IDE

Leave a Reply

Your email address will not be published. Required fields are marked *