Selenium IDE "verifyValue" and "assertValue" commands use with Example

In Selenium IDE, "verifyValue" and "assertValue" commands are used with check box or radio button elements. As name suggests, Both are used only for verification of check box or radio button's ON/OFF(Check/Unchecked) status. Only difference between "verifyValue" and "assertValue" command is
"verifyValue" will keep execution continue on fail and "assertValue" command will stop execution of selenium IDE.

Selenium IDE "verifyValue" Command
"verifyValue" command will verify ON/OFF status of targeted check box or radio button. it will be pass if targeted element status match with given condition else it will return "[error] Actual value 'off' did not match 'on'" or "[error] Actual value 'on' did not match 'off'" in selenium command execution log.

"assertValue" Command in Selenium IDE
Same as "verifyValue" command, "assertValue" command will also check status of targeted check box or radio button and will pass if condition match. Else it will return error in log and not execute remaining commands.

Let me give you one simple example for verification of radio buttons check status.

New Test

In above example, '//input[@id='group_152423055_2']' is Xpath of 'QTP' radio button and '//input[@id='group_152423055_1']' is Xpath of 'Selenium' radio button. 

  • 3rd "click" command will select 'QTP' radio button.
  • 4th "verifyValue" command will verify on/off status of check box and it will be pass because radio button is already checked so actual value 'on' did match 'on'.
  • 5th "click" command will select 'Selenium' radio button so 'QTP' radio button's selection will be removed.
  • 6th "verifyValue" command will fail and return "[error] Actual value 'off' did not match 'on'" because now radio button's selection is moved on 'Selenium' radio button.
  • 7th and 8th "assertValue" commands will pass because conditions for both the commands will match now.
  • 8th "assertValue" command will fail and return "[error] Actual value 'on' did not match 'off'" in log and now due to the assert command, selenium will stop execution and next command will be not executed.
Same way you can use"verifyValue" and "assertValue" commands with check box too.

No comments:

Post a comment