feat: allow evaluate_script to skip the stable DOM wait#2346
Open
thomasbachem wants to merge 1 commit into
Open
feat: allow evaluate_script to skip the stable DOM wait#2346thomasbachem wants to merge 1 commit into
thomasbachem wants to merge 1 commit into
Conversation
hotrod6531-sudo
approved these changes
Jul 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2338
Adds a
waitForStableDomparameter toevaluate_script(defaulttrue). Passingfalseskips just the stable DOM wait inwaitForEventsAfterAction()– the navigation probe and dialog handling stay, so a script that unexpectedly navigates is still awaited (and the navigation reported), and analert()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 genartifacts (tool_call_metrics.json+chrome-devtools-cli-options.ts, so check-docs passes), a skip test that spiesWaitForHelper.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.