Class WebDriverWait
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
driverIWebDriverThe WebDriver instance used to wait.
timeoutTimeSpanThe 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
clockIClockAn object implementing the IClock interface used to determine when time has passed.
driverIWebDriverThe WebDriver instance used to wait.
timeoutTimeSpanThe timeout value indicating how long to wait for the condition.
sleepIntervalTimeSpanA TimeSpan value indicating how often to check for the condition to be true.
Exceptions
- ArgumentNullException
If
clockordriverare null.