Introduction-to-Verify-Element-Present-and-Wait-in-Selenium-IDE

Introduction to Verify Element Present and Wait in Selenium IDE

Table of Contents

Verify Presence of an Element

There are two commands to check the presence of a UI element on a web page:

  • verify element present: This command is used to check if an element is present on the web page. If this command fails, then the execution will not stop and continue with the next commands. It will return TRUE if the specified element is present on the page; otherwise, it returns FALSE.
  • verify element not present: This command is used to check if an element is not present on the web page. If this command fails, then the execution will not stop and continue with the next commands. It will return FALSE if the specified element is not present on the page; otherwise, it returns TRUE.

Below is an example to verify that the UserName text box is visible within the Mercury Tours homepage, and the First Name text box is not. The First Name text box is present on the Registration page of the Mercury Tours website and not on the homepage.

Introduction to Verify Element Present and Wait in Selenium IDE

Wait commands

These commands are used when we want to wait for a specified condition to become true before moving on to the next command. 

 

  • wait for element editable: Suppose any element that is non-editable on the web page gets editable after some time, then we use this command. It will wait for the element to become editable.

 

To understand this, we will navigate to http://omayo.blogspot.com/, and we will wait for the checkbox to become editable after we click on Check this button.

Introduction to Verify Element Present and Wait in Selenium IDE

 

  • wait for element not editable: Suppose any element that is editable on the web page gets non-editable after some time, then we use this command. It will wait for the element to become non-editable.

 

To understand this, we will navigate to http://omayo.blogspot.com/, and we will wait for the button to become non-editable after we click on Try it button.

Introduction to Verify Element Present and Wait in Selenium IDE

 

  • wait for element visible: Suppose any element that is not visible on the web page gets visible after some time, then we use this command. It will wait for the element to become visible.

 

Let us take an example:

Introduction to Verify Element Present and Wait in Selenium IDE

Here “This text is displayed after 10 seconds of wait” get displayed on the web page after waiting for 10 seconds.

  • wait for element not visible: Suppose any element that is visible on the web page gets invisible after some time, then we use this command. It will wait for the element to disappear from the web page.

Introduction to Verify Element Present and Wait in Selenium IDE

To execute the above scenario, we will use wait for element not visible command.

Introduction to Verify Element Present and Wait in Selenium IDE

 

  • wait for element present: This command will wait for the element to be present on the web page.

 

Introduction to Verify Element Present and Wait in Selenium IDE

 

  • wait for element not present: This command will wait for the element to be not present on the web page.

 

Introduction to Verify Element Present and Wait in Selenium IDE

 

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share this article
Subscribe
By pressing the Subscribe button, you confirm that you have read our Privacy Policy.
Need a Free Demo Class?
Join H2K Infosys IT Online Training
Enroll Free demo class