Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
RenderMichael opened this issue Feb 20, 2025 · 5 comments · May be fixed by #15838
Open
Labels
A-needs-triaging A Selenium member will evaluate this soon! B-support Issue or PR related to support classes C-dotnet .NET Bindings I-enhancement Something could be better

Comments

@RenderMichael
Copy link
Contributor

RenderMichael commented Feb 20, 2025

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")));
@RenderMichael RenderMichael added I-enhancement Something could be better A-needs-triaging A Selenium member will evaluate this soon! labels Feb 20, 2025
Copy link

@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
Copy link
Member

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

@RenderMichael
Copy link
Contributor Author

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.

@RenderMichael RenderMichael added the C-dotnet .NET Bindings label Feb 20, 2025
@nvborisenko
Copy link
Member

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

@RenderMichael RenderMichael added the B-support Issue or PR related to support classes label Jun 1, 2025
@selenium-ci
Copy link
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
Labels
A-needs-triaging A Selenium member will evaluate this soon! B-support Issue or PR related to support classes C-dotnet .NET Bindings I-enhancement Something could be better
Projects
None yet
3 participants