Both "assertSelectedLabel" and "assertSelectedValue" are selenium IDE assertion commands. Both are working with list box and drop down. Some people thinking that both of them are same and i also received some requests from my blog reader to describe the difference between both of them. So, Let me try here to show you clear difference between both these commands.
"assertSelectedLabel" Command
"assertSelectedLabel" command works with drop down or list box and useful to verify label (visible text) of selected label.
"assertSelectedValue" Command
"assertSelectedValue" command is also working with list box or drop down and useful to option value (value attribute) of selected label.
Above image shows HTML view of list box using firebug. As you see in image, selected option's visible text (Label)= 'Germany' which is marked with green line in HTML view and it's Value attribute = 'DEU'. So if you want to use "assertSelectedLabel" command then you need to use 'Germany' in value column and if you want to use "assertSelectedValue" command then you need to use 'DEU' in value column. This is the difference between them.
Run bellow given example in your selenium IDE for better understanding.
New Test
| ||
Command
|
Target
|
Value
|
open
|
http://only-testing-blog.blogspot.com/2013/09/test.html
| |
addSelection
|
name=FromLB
|
label=Germany
|
assertSelectedLabel
|
name=FromLB
|
Germany
|
assertSelectedValue
|
name=FromLB
|
DEU
|
THIS LINK will show you more related commands of selenium IDE.
No comments:
Post a Comment