Skip to content
New issue

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

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

Already on GitHub? # to your account

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

Open
RenderMichael opened this issue Feb 20, 2025 · 4 comments

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")));
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.

@nvborisenko
Copy link
Member

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants