w3c / w3c/webdriver

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

Open
#1,857 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Navigate To needs-discussion
Dominant language
HTML
Stars
718
Forks
228
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the navigation algorithm and comparing it with the behavior before PR #1802, including the missing sentence quoted here. Reproduce the alert example and examine how user prompts interact with navigation timeouts, then consider the stated WebDriver BiDi compatibility and broader command-handling concerns before defining completion.

Written by the indexing model from the issue text.

Assessment

Domain
api
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.