How to Use the Verify Mechanism to Validate Elements in Selenium?

The following steps will help you validate elements using verify mechanism.

  1. Go to Firefox Browser-> Tools Menu and launch Selenium IDE.
  2. Ensure the ‘Record’ option is enabled by default.
  3. Go to the Google home page.
  4. Right-click on the UI element to be validated on the Google page, e.g. Google Logo.image001
  5. Select ‘Show All Available commands’ from the right click menu option.image002
  6. From the sub-menu options displayed for the ‘Show All Available commands’ select the ‘VerifyElementPresent’ option.
  7. This will add the ‘VerifyElementPresent’ element. This can be verified by navigating to Selenium IDE->Table tab.
  8. To turn off the recording process, click on the ‘Record’ button.image008
  9. Click on ‘Play current test case’ option to run the recorded validation on Selenium IDE.image010
  10. This will display the ‘verifyElementPresent’ command in green color. This ensures that the test is passed and the UI element is present.image011
  11. However, if the step gets failed the element will be displayed in red color. This means the element is not present.image012

Note: If Selenium IDE is not installed on Firefox browser, verify commands in the right click menu and sub-menu options won’t be displayed.


Get A Free Quote