Refer the article New Selenium IDE – Commands (Selenese), for the complete list of Selenium IDE commands and their practical demonstrations.
verify element present is one of the commands in Selenium IDE.
The purpose of verify element present command in Selenium IDE, is to check whether the given UI element is present on the page.
Difference between assert element present and verify element present commands
Though the purpose of assert element present and verify element present commands are same, verify element present command will act as a soft assertion.
If the verify element present command fails in Selenium IDE, the execution won’t stop and the steps which come after the failed verify element present step will be executed.
Whereas if the assert element present command fails during execution, the complete execution will stop there itself and the steps which come after the failed assert element present won’t be executed.
In this article, I am going to practically demonstrate verify element present command in Selenium IDE for checking whether the given UI element is present on the page as shown below:
Let’s get started.
New Selenium IDE – Using ‘verify element present’ command to check the UI element is present on the page
Follow the below steps for practicing verify element present command in Selenium IDE along with me:
1) Execute the open command in Selenium IDE as explained in the previous article: Selenium IDE – open command
2) Now click on the second row in the Selenium IDE’s Test Script Editor Box as shown below:
3) While the second row is selected in step 2, enter the Selenium IDE command ‘verify element present’ to the Command box field, enter the name locating strategy id=but2 into the Target box field as shown below:
Note: The locating strategy id=but2 is for locating the Button2 button on the http://omayo.blogspot.com/ URL page (Shown at the beginning of the article).
4) Click on ‘Run current test’ option as shown below:
5) Observe that the verify element present command in the Selenium IDE will be executed, and the result will be passed as shown below:
We have checked that the required Button2 button is present on the page. If the required UI element is not available on the page, then you will get a failure message.
6) Now let’s modify the locating strategy given in the above example to something that is not available on the web page say id=buttonxyz and execute the test so that it fails as shown below:
Here concludes the practical demonstration of verify element present command in Selenium IDE.
As already explained above, verify element present command when failed won’t stop the complete execution and the steps which come after the verify element present command will be executed. Whereas assert element present command when failed will stop the complete execution and the steps which after the assert element present command won’t be executed. The below screenshot proves it:
In the next article, I will practically demonstrate another Selenium IDE command.
Next Steps:
- > Check complete Selenium Tutorial Contents here (Click here)
Please leave your questions/comments/feedback below.
Happy Learning ?
On a mission to contribute to the Software Testing Community in all possible ways.
Refer the article New Selenium IDE – Commands (Selenese), for the complete list of Selenium IDE commands and their practical demonstrations.
But how do you use the fact that verify element present failed or passed?
Hello Arun! How can I check that what the result of verify element present is? I mean how can I know if the element appeared or not? I want to make an if concerning this information.