jonhoo / fantoccini

A high-level API for programmatically interacting with web pages through WebDriver.
Apache License 2.0
1.68k stars 125 forks source link

wait_* methods deprecated with no alternative #242

Closed MolotovCherry closed 9 months ago

MolotovCherry commented 9 months ago

The wait_for* methods are deprecated, and offer client.wait().on(...) as a solution, but this on() function does not exist, making it impossible to achieve a custom wait condition without using deprecated code

(Of course, naturally, one could custom implement this, but it would be nice if it was part of the library again)

Edit: This message has come to my attention:

I actually ended up removing the generic interface, and stuck with just the concrete methods for Url and Locator. My thinking is that for those we may be able to provide smarter retries over time (e.g., using JavaScript event observers). The same isn't true for general-purpose asynchronous closures, so I'd rather not give users that impression. It's pretty easy to implement one's own loop (it's really just a loop with a tokio::time::sleep), so I'd rather keep that in the caller's code.

Could we update the deprecation notices on the functions? It gave me a false expectation/impression that this functionality was supposed to be here but is missing

jonhoo commented 9 months ago

Ah, yes, you're entirely right. The history here is that https://github.com/jonhoo/fantoccini/pull/134 landed the .wait().on() interface, and then in https://github.com/jonhoo/fantoccini/commit/8ac0f90d9fcca20aca6879b484eb0bdf120f78b1 I got rid of the general-purpose variant because it gave the illusion that we'd be handling these calls in some kind of efficient way. Totally agree with you that the deprecation notices are wrong. Will update shortly!

jonhoo commented 9 months ago

https://github.com/jonhoo/fantoccini/pull/243