Skip to content
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

Restore behavior of wait for navigation to complete when a user prompt is opened (from before PR #1802 landed) #1857

Open
whimboo opened this issue Nov 7, 2024 · 1 comment

Comments

@whimboo
Copy link
Contributor

whimboo commented Nov 7, 2024

As noted in this GitHub comment, we introduced a regression in our wait for navigation to complete algorithm, which causes timeouts to be mishandled when a user prompt is opened. The missing sentence from the original specification is:

If the previous step completed by the session page load timeout being reached and the browser does not have an active user prompt, return error with error code timeout.

Currently, this causes the navigation to always timeout.

In addition to restoring this behavior, I’m questioning why we need to wait for a timeout before checking for user prompts. While beforeunload prompts are automatically dismissed in WebDriver classic, we don’t do this for other prompt types like alert, confirm, and prompt. This results in a timeout delay, which defaults to 300 seconds! Why can't we simply return from the navigation as soon as a user prompt is opened?

Here’s a basic example of a page that would cause a timeout:

<script>
  window.alert("test");
</script>

Additional thoughts:

  • All major browsers currently detect user prompts the moment they appear, causing the navigation to return immediately.
  • We may want this behavior to apply to all commands, which would require a more general handling mechanism.
  • We need to ensure that this change does not introduce any new regressions or create incompatibility with WebDriver BiDi.
@css-meeting-bot
Copy link
Member

The Browser Testing and Tools Working Group just discussed Restore behavior of wait for navigation to complete when a user prompt is opened.

The full IRC log of that discussion <AutomatedTester> topic: Restore behavior of wait for navigation to complete when a user prompt is opened
<AutomatedTester> github: https://github.com//issues/1857
<AutomatedTester> whimboo: we have had someone spot a regresdsion when we have an alert open with navigation to complete
<AutomatedTester> ... we aren't waiting for the alert, we return immediately saying timeout
<AutomatedTester> ... my question is "Do we want to return early if there is an alert?" I think it would be better if we were to return immediately
<AutomatedTester> q?

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

No branches or pull requests

2 participants