w3c / webdriver-bidi

Bidirectional WebDriver protocol for browser automation
https://w3c.github.io/webdriver-bidi/
336 stars 35 forks source link

Add timeout argument to browsingContext.navigate #188

Open whimboo opened 2 years ago

whimboo commented 2 years ago

For wait states of interactive and complete there is no possibility right now to set a navigation timeout which would mean browsingContext.navigate would never return. Given that we don't want to use the global state (new session's capabilities) we will have to get a timeout argument added to BrowsingContextNavigateParameters.

whimboo commented 2 years ago

The BiDi client could handle a timeout on its own. But the question is when and how an active navigation should be canceled by the remote end itself. If the client would have to do the cancellation on its own instead, it might not have the necessary navigation id to do so in case of wait is interactive or complete.

css-meeting-bot commented 2 years ago

The Browser Testing and Tools Working Group just discussed timeout argument for browsingContext.navigate.

The full IRC log of that discussion <jgraham> Topic: timeout argument for browsingContext.navigate
<jgraham> github: timeout argument for browsingContext.navigate
<sadym> q+
<jgraham> github: https://github.com/w3c/webdriver-bidi/issues/188
<jgraham> ack sadym
<simonstewart> q+
<brwalder> jgraham: Timeout for navigate. Useful to cancel a navigation that doesn't return immediately. Since we're adding helpers for waiting for DOM loaded events, it seems useful to also cancel that operation if it isn't reached after a certain time.
<brwalder> sadym: What do existing protocols do and what should happen on the browser side if the timeout is reached?
<sadym> q+
<brwalder> jgraham: Equivalent of the stop button. Or, do what classic WebDriver does.
<jgraham> ack simonstewart
<brwalder> simonstewart: In classic, if you exceed the global timeout, I think we cancel the request. A primitive to cancel a request would be useful for network interception too. Global timeouts have been limiting in webdriver classic, so having per-command timeouts would be useful.
<jgraham> ack sadym
<jgraham> q+
<brwalder> sadym: Can we make the proposed cancel mechanism part of the network interception API?
<jgraham> ack jgraham
<foolip> Looks like https://w3c.github.io/webdriver/#navigate-to and https://w3c.github.io/webdriver/#dfn-session-script-timeout is how this works in WebDriver classic.
<jgraham> ack jgraham
<brwalder> jgraham: There's a difference between cancelling a navigation and a network request. A navigation has a 1:N relationship with network requests.
thiagowfx commented 8 months ago

A primitive to cancel a request would be useful for network interception too

I am facing exactly this as I continue to work on the network interception implementation in Chromium.

Should we add the timeout to the navigate command directly in the spec, or should we modify the WPT "navigate" wrapper to support timeouts?