"assertNotSelectedLabel" and "assertNotSelectedLabels" are very useful assertions in selenium IDE software for drop down and list box type elements. However you can look at other related commands examples on this Link. As you know, If any of the above assert command will fail, selenium IDE will stop
its execution immediately. However in case of verification commands, Selenium IDE will continue its execution even if that verify command will fail. So this is the main difference between "assert" and "verify". You can Take a Selenium IDE Online Test which will helps you for selenium IDE interview preparation. Let me come to the point, we need to look at practical examples of "assertNotSelectedLabel" and "assertNotSelectedLabels" commands.
"assertNotSelectedLabel" Command
"assertNotSelectedLabel" is works with drop down or list box for single selected label. It will fail if selected label string will match with expected label string. Else it will be pass.
Example
New Test | ||
Command | Target | Value |
open | http://only-testing-blog.blogspot.com/2013/09/testing.html | |
addSelection | name=FromLB | label=Germany |
assertNotSelectedLabel | name=FromLB | India |
removeSelection | name=FromLB | label=Germany |
addSelection | name=FromLB | label=India |
assertNotSelectedLabel | name=FromLB | India |
Look in to above example, First "assertNotSelectedLabel" command will become pass because actual value will not match with expected value. But last"assertNotSelectedLabel" command will fail. Run both examples in selenium IDE to confirm its function.
"assertNotSelectedLabels" Command
"assertNotSelectedLabels" command works same as "assertNotSelectedLabel" command but it is supporting multiple labels too. It will return error like '[error] Actual value 'India,Italy' did match 'India,Italy'' if both values will match.
Example
New Test | ||
Command | Target | Value |
open | http://only-testing-blog.blogspot.com/2013/09/testing.html | |
addSelection | name=FromLB | label=Italy |
addSelection | name=FromLB | label=Germany |
assertNotSelectedLabels | name=FromLB | India,Italy |
removeSelection | name=FromLB | label=Germany |
addSelection | name=FromLB | label=India |
assertNotSelectedLabels | name=FromLB | India,Italy |
Hello,
ReplyDeletecan any one please help me...
I want to run an entire test suite(not a single test case) continuously using selenium ide...
Is it possible?
You can do it by clicking on 'Run Entire Test Suite' button of selenium IDE. Find more info at http://software-testing-tutorials-automation.blogspot.in/2011/10/how-to-use-selenium-ide-toolbar.html
ReplyDeletethank you for your post. It was very helpful.
ReplyDeleteaddselection command not working can any one please explain
ReplyDeleteHello,
ReplyDeleteIn real time(banking proj) in which scenario do we use assertNotSelectedLabel/assertNotSelectedLabels?
I understood that in dropdowns we use this command and if actual and expected matches it fails .But what is the purpose of using it ?Are we checking whether the options that is selected through add selection is shown as selected?
Consider scenario -> Sometimes, When you are loading or redirecting to some page. On page redirection, You your condition Is some labels should be selected or should not selected before performing any action on that page. In such situation, You need these commands
DeleteI logged on to a website with ID & Password. Here the browser is prompting for 'Save Password or Cancel'. I selected 'Cancel' and this is one time activity.
ReplyDeleteSelenium is throwing an error here.
How to code it in such scenario ?
Please let me konw.