Assert mechanism check the elements on the page and helps in carrying out the test successfully. This mechanism validates the elements on the page in the following way.
- Open Firefox and go to the Tools menu. From there launch Selenium IDE.
Note: You must install Selenium IDE to follow the steps.
- Ensure that the ‘Record’ option is enabled by default.
- Type google.com and press enter to open the Google home page.
- Right-click on the UI element that needs to be validated. IN this case, Google Logo needs to be validated.
- Right-click menu options and select ‘Show All Available commands’.
- Select ‘AssertElementPresent’ from the sub-menu option of the ‘Show All Available commands’.
- Ensure that the ‘assertElementPresent’ is added in the Selenium IDE table tab.
- Turn off the recording process by clicking on the ‘Record’ button.
- Click ‘Play current test case’ on the Selenium IDE to run the recorded validation.
- Ensure that the ‘assertElementPresent’ command is reflecting in green color. Green indicates that the step has been passed.
- The ‘assertElementPresent’ command will reflect in red if the element is not present.
- If the test fails, it won’t execute the steps thereafter.