HomeSelenium

New Selenium IDE – Using ‘verify element present’ command to check the UI element is present on the page

New Selenium IDE – Using ‘verify element present’ command to check the UI element is present on the page

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:

verify element present Selenium IDE - demo

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:

type Selenium IDE - click Row

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).

verify element present Selenium IDE - typing

4) Click on ‘Run current test’ option as shown below:

verify element present Selenium IDE - run

5) Observe that the verify element present command in the Selenium IDE will be executed, and the result will be passed as shown below:

verify element present Selenium IDE - executed

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:

verify element present Selenium IDE - eTwo

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:

verify element present Selenium IDE - difference

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 🙂

About Me > Arun Motoori

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.

If you like this article, share it on LinkedIn using the below button:

Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *