Tuesday, October 1, 2013

Now update a test to verify items on the page


Updating a test to assert items are on the page


1. Open the IDE so that we can start recording.
2. Navigate to http://qc.test.com
3. Select Selenium Grid from the drop-down box.
4. Change the Select to Selenium Grid.
5. Verify that Assert that this text is on the page text is mentioned on the righthand
side of the drop-down box, by right-clicking on the text and selecting Verify
TextPresent Assert that this text is on the page. You can see the command in the
previous screenshot.
6. Verify that the button is on the page. You will need to add a new command for
verifyElementPresent with the target verifybutton in Selenium IDE.
7. Now that you have completed the previous steps, your Selenium IDE should look like
the following screenshot






If you now run the test you will see it has verified that what you are expecting to see on the


page has appeared. Notice that the verify commands have a darker green color. This is to
show that they are more important to the test than moving through the steps. The test has
now checkedthat the text we required is on the page and that the button was there too.




What would happen if the verify command did not find what it was expecting? The IDE
would have thrown an Error stating what was expected was not there, but it carried on
with the rest of the test. We can see an example of this in the following screenshot:


The test would not have carried on if it was using assert as the mechanism for validating that
the elements and text were loaded with the page.

No comments:

Post a Comment