"verifySomethingSelected" and "verifyNotSomethingSelected" commands in selenium with example


"verifySomethingSelected" commands

"verifySomethingSelected" is used with drop downs and list boxes. Its name describes its function so that i think i do not need to describe it more. It is used to verify that is there any label is selected in drop down or not. It will becomes pass if any one label is selected. Else it will return "false" in log. Run bellow example with
selenium IDE so that you can get it better.

"verifyNotSomethingSelected" commands

"verifyNotSomethingSelected" is verifying same thing but it will return "true" in log if any label is selected in drop down or list box. Else it will becomes pass.

New Test
CommandTargetValue
openhttp://www.w3schools.com/tags/tryit.asp?filename=tryhtml_select_size
verifySomethingSelectedcss=select
verifyNotSomethingSelectedsb_form_go
pause5000
selectcss=selectlabel=Saab
verifySomethingSelectedcss=select
verifyNotSomethingSelectedsb_form_go

In above example, 
1st "verifySomethingSelected" command will return "[error] false" in log because there is not any label is selected.
2nd "verifySomethingSelected" command will becomes pass because before execution of it, selenium will select "label=Saab" in previous command.

1st "verifyNotSomethingSelected" command will becomes pass because there is not selected any label on initial level.
2nd "verifyNotSomethingSelected" command will return "[error] true" in log because there is selected one label (label=Saab).

No comments:

Post a Comment