Skip to content

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

Open
@RenderMichael

Description

@RenderMichael
Contributor

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

github-actions

github-actions commented on Feb 20, 2025

@github-actions

@RenderMichael, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

nvborisenko

nvborisenko commented on Feb 20, 2025

@nvborisenko
Member

Support package which is not supported... I think long-term plans just to remove this package:

RenderMichael

RenderMichael commented on Feb 20, 2025

@RenderMichael
ContributorAuthor

WebDriverWait is in the support namespace of the normal WebDriver package. I'm not sure what the policy is there.

Also, support is very very much widely used. We could consider it "feature-complete" and avoid unnecessary development, but removing it will be even more painful than removing GetAttribute in my estimation.

nvborisenko

nvborisenko commented on Feb 23, 2025

@nvborisenko
Member

I suppose it is leftovers of big deprecation, @jimevans is it right?

selenium-ci

selenium-ci commented on Jun 1, 2025

@selenium-ci
Member

Hi, @RenderMichael.

This is related to code in the Support packages. The support packages contain example code that
many users find helpful, but they do not necessarily represent the best practices for using Selenium,
and the Selenium team is not prioritizing work on them right now.
This doesn't mean that we won't ever work on them, but it is not on our roadmap as we push to release Selenium 5.

We actively encourage people to create their own wrapper and helper code that makes sense for them.
If you have any questions, please contact us

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-needs-triagingA Selenium member will evaluate this soon!B-supportIssue or PR related to support classesC-dotnet.NET BindingsI-enhancementSomething could be better

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @selenium-ci@RenderMichael@nvborisenko

      Issue actions

        [dotnet] [🚀 Feature] Add `WebDriverWait` constructor for timeout and interval without a clock · Issue #15314 · SeleniumHQ/selenium