Updating a test to assert items are on the page - Selenium

In the last few steps we were able to record a workflow that we would expect the user to perform. It will test that the relevant bit of functionality is there, like buttons and links to work against. Unfortunately we are not checking that the other items on the page are there or if they are visible when they should be hidden. We are going to work against the same page as before but we shall make sure that different items are on the page.

There are two mechanisms for validating elements available on the application under test. The first is assert; this allows the test to check if the element is on the page. If it is not available then the test will stop on the step that failed. The second is verify; this also allows the test to check the element is on the page, but if it isn't then the test will carry on executing.

To add the assert or verify commands to the tests we need to use the context menu that Selenium IDE adds to Firefox. All that one needs to do is right-click on the element if on Windows or Linux. If you have a Mac, then you will need to do the two finger click to show the context menu.

When the context menu appears, it will look roughly like the following screenshot with the normal Firefox functions above it:

open chapter
verifyTextPresent Assert that this text is on the page
verifyValue
storeValue
verifyText divontheleft Assert that this text is on the page
verifyElementPresent divontheleft
wait For Element Presentdivontheleft
Show All Available Commands


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Selenium Topics