-
Notifications
You must be signed in to change notification settings - Fork 128
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
Retry api (#81) #85
base: main
Are you sure you want to change the base?
Retry api (#81) #85
Conversation
I'm still not sure I understand the value of having this inside |
Perhaps I misunderstood the crate's description: a high-level API for programmatically interacting with web pages through WebDriver? It seems like most browser automation use cases will require retries, and having an API for limiting retries would be super convenient. This design makes all the calls consistent, so clicks/submits/etc could all be retried the same way. There is the futures-retry crate which I could use for everything that isn't |
Haha, you're right, the description is basically exactly contrary to what I just wrote above. I think what happened is that I set the description early on in the process, and only later realized that it'd be better for I think I still don't quite understand the desire to have this timeout logic in |
While I'm personally most interested in getting the timeout stuff merged since it would make fantoccini the only dependency I need for writing browser automation tests, I suppose they aren't too difficult to write in my tests. Having a unified way to retry any operation, and not just finds, would be pretty slick though. I have a handful of loops that try to click on an element that takes a moment to appear because of JavaScript. |
I'm not sure I follow this? You still need
Hmm, but isn't that exactly waiting for a find and then doing |
Sorry, I don't mean reducing the number of crates I depend on. I guess I'm saying that I'd like to reduce the cognitive load for writing tests, and having tools that solve common testing use cases in one crate helps with that.
If the element is in the DOM, but isn't visible, I get an error about not being able to scroll it into view. |
Ah, I see what you mean. It's tricky, because while I agree with the general sentiment, in the specific context of futures it sort of means that every crate "should" re-include every combinator. For example, if we wanted to support clicking either of two elements, we'd have to support a
I think I might need some code to understand why the current API can't do this, but the proposed one can. |
I think you could implement
I've opened #90 since I think it deserves its own conversation. It could be solved by either adding
|
Thinking about this a bit more, I think my main complaint about the current fantoccini API is that I can't add convenience methods on an extension trait generically for all operations. If that were possible, I could add How would you feel about this PR if:
|
I have a bit of a hard time imagining exactly what that would look like, but it sounds like a promising idea! |
This is kind of what I was thinking for #81. It lets you write code pretty much exactly like the example in that issue. Wanted to get your thoughts on it before I went too much further.