LambdaTest Community

Find answers, support, and inspiration from other users

LambdaTest Community

What is Explicit Wait in Selenium C#? What are the steps to be followed when executing Explicit wait command?

Lstely i have been trying to seek knowledge regarding what is Explicit Wait in Selenium C# and also what are the steps to be followed when executing Explicit wait command.

Up Vote Down Vote 0 Votes
Posted 3 months ago


Unlike implicit wait, explicit wait in Selenium will wait for certain conditions to occur. The conditions could be waiting for the presence of the web element, waiting for the element to be clickable, waiting for the element to be visible, etc.

Explicit wait in Selenium is also called smart wait as the wait is not for the maximum time-out. If the condition for explicit wait is satisfied, the wait condition is exited and the execution proceeds with the next line of code. Depending on the test scenario, you should choose the best-suited wait condition for explicit wait.

Unlike implicit wait that applies till the time the Selenium WebDriver instance (or IWebDriver object) is alive, explicit wait in Selenium works only on the particular web element on which it is set, rather than all the elements on the page.

Explicit wait in Selenium can be used in test scenarios where synchronization is needed i.e. loading of the web page is complete and you are waiting for the element (under test) to be visible.

The figure shows what happens under the hoods when explicit wait in Selenium is triggered:

These steps are followed in sequence when Explicit Wait command is executed:

  • The wait time is entered as a part of explicit wait command [e.g. WebDriverWait wait = WebDriverWait(driver, TimeSpan.FromSeconds(10));]
  • Condition mentioned in .until() method is checked
  • If the condition is not satisfied, a thread sleep is called at the frequency mentioned in the .pollingInterval property. By default, the polling interval is 250 ms.
  • Step (c) is repeated till the timeout of the wait time mentioned in step (a) or exit before timeout is performed, if required web element is located. The status of .until() condition is monitored at the end of every polling duration
Up Vote Down Vote 0 Votes
Posted 3 months ago
1 Answer
3 months ago