As we've learnt in the previous post that assert will check whether the element is on the page, if it is not available, the test will fail the step and wont continue executing the remaining steps.
The following steps will show how assert mechanism validates elements:
Example: Check whether the Google Logo is available on the www.Google.com page. (i.e. The test will pass if the Google Logo exists on the Google page else it fails).
1. Launch Selenium IDE from Firefox Browser -> Tools Menu
2. Ensure that the Selenium IDE is launched and also ensure that 'Record' option is enabled by default.
3. Type www.google.com in the Firfox Address bar and press 'Enter' button on the keyboard
4. Ensure that the Google page is displayed in the Firefox Browser
5. In Google Page, right click on the UI element to be validated i.e Google Logo in this example as shown below:
6. In the right click menu options, select 'Show All Available commands' option as shown below:
11. After the test Run, ensure that the 'assertElementPresent' command under the Selenium IDE -> Table tab is displayed in Green color (i.e.Green means the step got passed and the UI element is present i.e. Google Logo in this example is present on the Google Page) as shown below:
12. If the element is not present (i.e. Google Logo in this example), then the step will fail and displayed in red color as shown below:
Note: - Assert commands in the right click menu and sub-menu options wont be shown if Selenium IDE is not installed on the Firefox browser
Please comment below to feedback or ask questions.
How to validate elements using Verify mechanism will be explained in the next post