Suppose you’re creating a test case in Selenium IDE and you want to verify the title of the web page, but you don’t want to stop the test case’s execution if it turns out to be different than what you expected.
You can do this by using the
verifyTitle command. This tutorial will walk you through the steps of verifying the title in Selenium IDE and help you understand the difference between the
The Verify Title Command
To verify a web page’s title in Selenium IDE, use the
verifyTitle command and enter the expected title in the “Target” field. The command will check the inner text of the <title> tag in your HTML document’s
<head> section to determine if the actual title and expected title are the same.
Let’s look at an example:
The example test case in the screenshot above verifies if the title of the web page you’re reading right now is exactly “How to Verify Title in Selenium IDE – Maker’s Aid.”
If so, the test will run without failures and the
verifyTitle step will be highlighted in green.
And if the title turns out to be different from the one we’ve specified in the “Target” field, the test will continue running but the
verifyTitle step will be highlighted in red, with an error.
The Assert Title Command
If you scroll through the list of available commands in Selenium IDE, you may notice that there’s a second command for the page’s title called
verifyTitle commands in Selenium IDE can be used to check the web page’s title. However, they make the tool behave differently when the title fails the test and turns out to be different from the one expected.
assertTitle command is a hard assertion. If the step fails, Selenium IDE will stop the test case’s execution and any steps below will remain unchecked.
The verifyTitle command is a soft assertion. If the step fails, Selenium IDE will continue the test case’s execution and go through the remaining steps below.
Thanks for reading this far. I hope this tutorial helped you figure out how to verify your HTML document’s title in Selenium IDE, and what the difference is between the
verifyTitle and the
Remember, both of these commands can be used to check a web page’s title, but Selenium IDE will behave differently with each command if the test step fails. Whereas
verifyTitle is a soft assertion and the test case’s execution will continue,
assertTitle is a hard assertion and the execution will stop.
This is key, as the inner text of the
<title> tag may or may not be a passing criterium for the test case as a whole.