Skip to content

[dotnet] [🚀 Feature] Add WebDriverWait constructor for timeout and interval without a clock #15314

Open
@RenderMichael

Description

Feature and motivation

Often times, when using WebDriverWait, we want to specify a custom sleep interval. However, it requires users to use the WebDriverWait(IClock clock, IWebDriver driver, TimeSpan timeout, TimeSpan sleepInterval) constructor overload, and users must learn about the IClock interface.

We can add a constructor WebDriverWait(IWebDriver driver, TimeSpan timeout, TimeSpan sleepInterval) which allows users to specify only the values they need.

The Java binding already has this overload

public WebDriverWait(WebDriver driver, Duration timeout, Duration sleep) {
this(driver, timeout, sleep, Clock.systemDefaultZone(), Sleeper.SYSTEM_SLEEPER);
}

Usage example

var wait = new WebDriverWait(driver, timeout: TimeSpan.FromSeconds(15), sleepInterval: TimeSpan.FromSeconds(1));
IWebElement element = wait.Until(driver => driver.FindElement(By.Name("q")));

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions