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
driver
IWebDriverThe WebDriver instance used to wait.
timeout
TimeSpanThe 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
IClockAn object implementing the IClock interface used to determine when time has passed.
driver
IWebDriverThe WebDriver instance used to wait.
timeout
TimeSpanThe timeout value indicating how long to wait for the condition.
sleepInterval
TimeSpanA TimeSpan value indicating how often to check for the condition to be true.
Exceptions
- ArgumentNullException
If
clock
ordriver
are null.