Selenium IDE – How “assertNotSelectedLabel” and “assertNotSelectedLabels” commands works

“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

7 thoughts on “Selenium IDE – How “assertNotSelectedLabel” and “assertNotSelectedLabels” commands works

  1. Hello,
    can 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?

  2. Hello,

    In 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?

  3. 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

  4. I 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.

    Selenium is throwing an error here.

    How to code it in such scenario ?

    Please let me konw.

Leave a Reply

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