What Is ExpectedConditions In Selenium.

QAutomation News / By Himanshu Sheth

The majority of the web products use AJAX (Asynchronous JavaScript and XML), due to which elements on the page are loaded at varying time intervals. This can lead to timing issues when automation testing is performed using the Selenium framework. What if a test is run on a WebElement that is not present in the DOM? The findElement function will raise ElementNotVisibleException.

Here are other scenarios that can cause issues in Selenium automation testing due to dynamic loading of elements:

  • WebElement (e.g. button) is visible but not clickable.
  • WebElement (e.g. label) is present in the DOM, but a certain text should be present in the element’s values attribute.
  • The title of the WebPage should consist of a case-sensitive substring and more.

The ideal way to overcome issues arising due to the dynamic loading of WebElements is by introducing Selenium waits in the test code implementation. Waits will provide the additional buffer-time required to complete the element’s loading and perform the necessary operation on the same. Rather than waiting for a specified time duration (also called Implicit Wait), wait is performed on a certain condition. These are called Expected Conditions in Selenium.

Continue reading from source link

One thought on “What Is ExpectedConditions In Selenium.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s