Table of Contents

Class WebDriverWait

Namespace
OpenQA.Selenium.Support.UI
Assembly
WebDriver.dll

Provides the ability to wait for an arbitrary condition during test execution.

public class WebDriverWait : DefaultWait<IWebDriver>, IWait<IWebDriver>
Inheritance
WebDriverWait
Implements
Inherited Members

Examples

IWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(3))
IWebElement element = wait.Until(driver => driver.FindElement(By.Name("q")));

Constructors

WebDriverWait(IWebDriver, TimeSpan)

Initializes a new instance of the WebDriverWait class.

public WebDriverWait(IWebDriver driver, TimeSpan timeout)

Parameters

driver IWebDriver

The WebDriver instance used to wait.

timeout TimeSpan

The timeout value indicating how long to wait for the condition.

WebDriverWait(IClock, IWebDriver, TimeSpan, TimeSpan)

Initializes a new instance of the WebDriverWait class.

public WebDriverWait(IClock clock, IWebDriver driver, TimeSpan timeout, TimeSpan sleepInterval)

Parameters

clock IClock

An object implementing the IClock interface used to determine when time has passed.

driver IWebDriver

The WebDriver instance used to wait.

timeout TimeSpan

The timeout value indicating how long to wait for the condition.

sleepInterval TimeSpan

A TimeSpan value indicating how often to check for the condition to be true.

Exceptions

ArgumentNullException

If clock or driver are null.