We already learnt "storeSelectedIndex" and "storeSelectedIndexes" commands with examples in my earlier post. "storeSelectedIndex" is storing index of currently single selected option from list box and "storeSelectedIndexes" command is useful to store index of multiple selected options from list box. Same
way, "storeSelectedValue" and "storeSelectedValues" are used with current selected label or labels of list box located in your software web application page. All these four commands are generally used for list box and drop down.
way, "storeSelectedValue" and "storeSelectedValues" are used with current selected label or labels of list box located in your software web application page. All these four commands are generally used for list box and drop down.
"storeSelectedValue" Ccommand
"storeSelectedValue" command will store name of current selected label. It will return error '[error] More than one selected option!' if there are more than one selected labels in list box.
"storeSelectedValues" command
"storeSelectedValues" command will store all selected label's names. Only difference is "storeSelectedValue" command works with single selection and in terms of multiple selections, you need to use "storeSelectedValues" command. Note here that "storeSelectedValues" command will works with single selected label too.
New Test | ||
Command | Target | Value |
open | http://only-testing-blog.blogspot.com/2013/09/testing.html | |
addSelection | name=FromLB | label=Mexico |
storeSelectedValue | name=FromLB | i |
echo | ${i} | |
addSelection | name=FromLB | label=India |
addSelection | name=FromLB | label=USA |
addSelection | name=FromLB | label=Spain |
storeSelectedValues | name=FromLB | j |
echo | ${j} |
Run above example in selenium IDE. "storeSelectedValue" will store current selected labels name 'Mexico' in variable i and "storeSelectedValues" command will store all selected labels (Mexico, India, USA, Spain) in variable j. Create same script for your software web application if there is any list box in your application.
No comments:
Post a Comment