Sunday 17 November 2019

What is Wait Command in Selenium?

The wait function is essential when it comes to executing Selenium test.When a page is loaded by the web browser the elements on the web page may load at different time intervals.

Wait Command can be mainly classified into :

1.Explicit Wait.
2.Implicit Wait.

   Explicit Wait:
Explicit Wait command informs the Web Driver to wait until a certain condition occurs before proceeding with executing the code.Explicit wait is a concept from the dynamic wait, which waits dynamically for specific conditions. Setting Explicit Wait is important in cases where there are certain elements that naturally take more time to load.Explicit wait time is applied only to those elements that are specified by the end user. In explicit wait, we need to specify the “ExpectedConditions” on the element  that is to be located.

   Implicit Wait:
Implicit wait time is applied to all the elements in the script.The implicit wait will tell to the web Driver to wait for certain amount of time before it throws a "No Such Element Exception.In implicit wait, we need not specify “ExpectedConditions” on the element to be located.Implicit wait is applied globally, which means it is always available for all the web elements throughout the driver instance.