Skip to content

feat: allow evaluate_script to skip the stable DOM wait#2346

Open
thomasbachem wants to merge 1 commit into
ChromeDevTools:mainfrom
thomasbachem:feat/evaluate-script-wait-for-stable-dom
Open

feat: allow evaluate_script to skip the stable DOM wait#2346
thomasbachem wants to merge 1 commit into
ChromeDevTools:mainfrom
thomasbachem:feat/evaluate-script-wait-for-stable-dom

Conversation

@thomasbachem

Copy link
Copy Markdown
Contributor

Closes #2338

Adds a waitForStableDom parameter to evaluate_script (default true). Passing false skips just the stable DOM wait in waitForEventsAfterAction() – the navigation probe and dialog handling stay, so a script that unexpectedly navigates is still awaited (and the navigation reported), and an alert() is still auto-handled. Both eval paths (page and service worker) pass the flag through.

Read-only evals drop from ~205ms to ~103ms on quiet pages, and from ~3.1s to ~103ms on pages that never go quiet – numbers and repro in #2338.

This is the branch the issue promised – I see #2344 beat me to posting, so take whichever is easier to review. Differences here: complete npm run gen artifacts (tool_call_metrics.json + chrome-devtools-cli-options.ts, so check-docs passes), a skip test that spies WaitForHelper.prototype.waitForStableDom (fails if the helper ignores the flag, not only if the option isn't passed through), and a test pinning the safety property – a script that navigates with the flag off still gets its navigation awaited and reported.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow read-only evaluate_script calls to skip the stable DOM wait

2 participants