Repository navigation
fix: waitForDomNetworkQuiet() can hang forever - #1284
Merged
seanmcguire12 merged 3 commits intoNov 18, 2025
Merged
seanmcguire12 merged 3 commits into
seanmcguire12 merged 3 commits into
Conversation
🦋 Changeset detectedLatest commit: 094ce98 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
Greptile Summary
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant ActHandler
participant waitForDomNetworkQuiet
participant Frame
participant CDP
User->>ActHandler: "act(instruction)"
ActHandler->>waitForDomNetworkQuiet: "waitForDomNetworkQuiet(frame, timeout)"
Note over waitForDomNetworkQuiet: "Start timer (settleStart)"
waitForDomNetworkQuiet->>Frame: "evaluate('document.readyState')"
Frame->>CDP: "Runtime.evaluate"
CDP-->>Frame: "readyState value"
Frame-->>waitForDomNetworkQuiet: "readyState result"
alt "Document not ready"
waitForDomNetworkQuiet->>Frame: "waitForLoadState('domcontentloaded', timeout)"
Frame->>CDP: "Page.enable"
Frame->>CDP: "Listen for Page.lifecycleEvent"
CDP-->>Frame: "LifecycleEvent(name='DOMContentLoaded')"
Note over Frame: "Normalize to lowercase"
Note over Frame: "Match 'domcontentloaded'"
Frame-->>waitForDomNetworkQuiet: "Load state reached"
end
Note over waitForDomNetworkQuiet: "Calculate elapsed & remainingBudget"
waitForDomNetworkQuiet->>CDP: "Network.enable, Page.enable"
Note over waitForDomNetworkQuiet: "Monitor network requests"
waitForDomNetworkQuiet->>CDP: "Listen for Network events"
CDP-->>waitForDomNetworkQuiet: "Network quiet (500ms)"
waitForDomNetworkQuiet-->>ActHandler: "DOM settled"
ActHandler-->>User: "Action completed"
|
Contributor
There was a problem hiding this comment.
2 files reviewed, no comments
Edit Code Review Agent Settings | Greptile
React with 👍 or 👎 to share your feedback on this new summary format
tkattkat
approved these changes
Nov 18, 2025
Merged
This was referenced Nov 19, 2025
seanmcguire12
pushed a commit
that referenced
this pull request
Nov 24, 2025
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @browserbasehq/[email protected] ### Patch Changes - [#1281](#1281) [`fa18cfd`](fa18cfd) Thanks [@monadoid](https://github.com/monadoid)! - Add Browserbase session URL and debug URL accessors - [#1264](#1264) [`767d168`](767d168) Thanks [@Kylejeong2](https://github.com/Kylejeong2)! - feat: adding gpt 5.1 to stagehand - [#1282](#1282) [`f27a99c`](f27a99c) Thanks [@tkattkat](https://github.com/tkattkat)! - Add support for zod 4, while maintaining backwards compatibility for zod 3 - [#1295](#1295) [`91a1ca0`](91a1ca0) Thanks [@tkattkat](https://github.com/tkattkat)! - Patch zod handling of non objects in extract - [#1298](#1298) [`1dd7d43`](1dd7d43) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - log Browserbase session status when websocket is closed due to session timeout - [#1284](#1284) [`c0f3b98`](c0f3b98) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix: waitForDomNetworkQuiet() causing `act()` to hang indefinitely - [#1246](#1246) [`44bb4f5`](44bb4f5) Thanks [@filip-michalsky](https://github.com/filip-michalsky)! - make ci faster - [#1300](#1300) [`2b70347`](2b70347) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - add support for context.addInitScript() ## @browserbasehq/[email protected] ### Patch Changes - Updated dependencies \[[`fa18cfd`](fa18cfd), [`767d168`](767d168), [`f27a99c`](f27a99c), [`91a1ca0`](91a1ca0), [`1dd7d43`](1dd7d43), [`c0f3b98`](c0f3b98), [`44bb4f5`](44bb4f5), [`2b70347`](2b70347)]: - @browserbasehq/[email protected] Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
michaelfp930-WB
added a commit
to michaelfp930-WB/stagehand
that referenced
this pull request
Jan 12, 2026
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @browserbasehq/[email protected] ### Patch Changes - [#1281](browserbase/stagehand#1281) [`fa18cfd`](browserbase/stagehand@fa18cfd) Thanks [@monadoid](https://github.com/monadoid)! - Add Browserbase session URL and debug URL accessors - [#1264](browserbase/stagehand#1264) [`767d168`](browserbase/stagehand@767d168) Thanks [@Kylejeong2](https://github.com/Kylejeong2)! - feat: adding gpt 5.1 to stagehand - [#1282](browserbase/stagehand#1282) [`f27a99c`](browserbase/stagehand@f27a99c) Thanks [@tkattkat](https://github.com/tkattkat)! - Add support for zod 4, while maintaining backwards compatibility for zod 3 - [#1295](browserbase/stagehand#1295) [`91a1ca0`](browserbase/stagehand@91a1ca0) Thanks [@tkattkat](https://github.com/tkattkat)! - Patch zod handling of non objects in extract - [#1298](browserbase/stagehand#1298) [`1dd7d43`](browserbase/stagehand@1dd7d43) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - log Browserbase session status when websocket is closed due to session timeout - [#1284](browserbase/stagehand#1284) [`c0f3b98`](browserbase/stagehand@c0f3b98) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix: waitForDomNetworkQuiet() causing `act()` to hang indefinitely - [#1246](browserbase/stagehand#1246) [`44bb4f5`](browserbase/stagehand@44bb4f5) Thanks [@filip-michalsky](https://github.com/filip-michalsky)! - make ci faster - [#1300](browserbase/stagehand#1300) [`2b70347`](browserbase/stagehand@2b70347) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - add support for context.addInitScript() ## @browserbasehq/[email protected] ### Patch Changes - Updated dependencies \[[`fa18cfd`](browserbase/stagehand@fa18cfd), [`767d168`](browserbase/stagehand@767d168), [`f27a99c`](browserbase/stagehand@f27a99c), [`91a1ca0`](browserbase/stagehand@91a1ca0), [`1dd7d43`](browserbase/stagehand@1dd7d43), [`c0f3b98`](browserbase/stagehand@c0f3b98), [`44bb4f5`](browserbase/stagehand@44bb4f5), [`2b70347`](browserbase/stagehand@2b70347)]: - @browserbasehq/[email protected] Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
felipeofdev-ai
pushed a commit
to felipeofdev-ai/stagehand
that referenced
this pull request
Aug 4, 2026
# why - this PR fixes an issue where `waitForDomNetworkQuiet()` does not resolve - this issue is caused by 2-3 underlying issues: - the first issue is that `frame.waitForLoadState()` was not listening for the correct lifecycle events from CDP. instead of listening for `DOMContentLoaded`, it was listening for `domcontentloaded` - the second issue is that `frame.waitForLoadState()` did not accept a timeout parameter - the third issue is that `waitForDomNetworkQuiet()` did not include the call to `frame.waitForLoadState()` as part of the total time that it waits for # what changed - added string normalization of incoming lifecycle events from CDP in `frame.waitForLoadState()` (fixes the first issue) - added a timeout parameter to `frame.waitForLoadState()` - within `waitForDomNetworkQuiet()`, I included the call to `frame.waitForLoadState()` as part of the total time that it waits for # test plan - existing unit tests & regression evals should be ok
felipeofdev-ai
pushed a commit
to felipeofdev-ai/stagehand
that referenced
this pull request
Aug 4, 2026
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @browserbasehq/[email protected] ### Patch Changes - [browserbase#1281](browserbase#1281) [`fa18cfd`](browserbase@fa18cfd) Thanks [@monadoid](https://github.com/monadoid)! - Add Browserbase session URL and debug URL accessors - [browserbase#1264](browserbase#1264) [`767d168`](browserbase@767d168) Thanks [@Kylejeong2](https://github.com/Kylejeong2)! - feat: adding gpt 5.1 to stagehand - [browserbase#1282](browserbase#1282) [`f27a99c`](browserbase@f27a99c) Thanks [@tkattkat](https://github.com/tkattkat)! - Add support for zod 4, while maintaining backwards compatibility for zod 3 - [browserbase#1295](browserbase#1295) [`91a1ca0`](browserbase@91a1ca0) Thanks [@tkattkat](https://github.com/tkattkat)! - Patch zod handling of non objects in extract - [browserbase#1298](browserbase#1298) [`1dd7d43`](browserbase@1dd7d43) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - log Browserbase session status when websocket is closed due to session timeout - [browserbase#1284](browserbase#1284) [`c0f3b98`](browserbase@c0f3b98) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix: waitForDomNetworkQuiet() causing `act()` to hang indefinitely - [browserbase#1246](browserbase#1246) [`44bb4f5`](browserbase@44bb4f5) Thanks [@filip-michalsky](https://github.com/filip-michalsky)! - make ci faster - [browserbase#1300](browserbase#1300) [`2b70347`](browserbase@2b70347) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - add support for context.addInitScript() ## @browserbasehq/[email protected] ### Patch Changes - Updated dependencies \[[`fa18cfd`](browserbase@fa18cfd), [`767d168`](browserbase@767d168), [`f27a99c`](browserbase@f27a99c), [`91a1ca0`](browserbase@91a1ca0), [`1dd7d43`](browserbase@1dd7d43), [`c0f3b98`](browserbase@c0f3b98), [`44bb4f5`](browserbase@44bb4f5), [`2b70347`](browserbase@2b70347)]: - @browserbasehq/[email protected]
robog-two
added a commit
to robog-two/clarity
that referenced
this pull request
Oct 27, 2026
Production run 4c935101 (Ulta) signed in, judged the half-rendered single-page
app at once ("did not happen, p=0.14"), concluded it was not signed in and
restarted the sign-in, costing the person SMS codes. Three changes:
Settle. After every action, navigation and sign-in step, and before look, read
and sign_in, wait until the document is ready, no request finished, no DOM
change and no Clarity step for 500 ms, and no spinner or skeleton is in view
(capped at 8 s). An unsettled report says "Still loading after N s" and never
"did not happen". The page's fetch is not wrapped (the probe stays in the
sandbox; wrapping the page realm is visible to bot detection), so the quiet
window also counts from Clarity's own step. Adopted from Playwright's 500 ms
networkidle window (https://playwright.dev/docs/api/class-page#page-wait-for-load-state),
browser-use's wait_for_network_idle_page_load_time 0.5 s
(https://github.com/browser-use/browser-use/blob/main/browser_use/browser/profile.py)
and Stagehand's capped DOM/network quiet wait
(browserbase/stagehand#1284).
Signed in sticks. A site is signed in on firm signals (no login form, not a
sign-in address, two of: sign-out control or greeting, new cookie names, Jev's
sign_in choice), after Playwright's auth guidance (https://playwright.dev/docs/auth).
Then look says "Signed in to x (since HH:MM)", sign_in refuses to start over
without a login or code field, act refuses sign-in starters and the control
that started this run's sign-in, and go to such a page gets a note. A code
field after sign-in is a second verification: a fresh ask_code, one new code
allowed by the guard, earlier code placeholders refused.
Scrolling. look lists scroll areas ("showing ~8 of ~30 rows, more below") and
how much page is below; act scrolls a named area or the one under the centre;
an off-screen target is scrolled into view before grounding
(https://playwright.dev/docs/actionability); read scrolls the page and each
area to the end and merges the overlap, so lazy and virtualized lists are read
whole. observe.js is split into per-op sections to stay under evaluate_script's
16 KiB.
Test site: a salon with a welcome page that starts sign-in, an SPA behind a
2 s spinner with a "Verify it's you" second-code dialog, and a fixed-layout
booking page with a lazy list of times and a virtualized list of dates. Unit
tests for each piece; a live run of the browser side without models
(LiveBrowserSalonPageTest) and a Jev run (LiveBrowserSalonTest).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NgQqhHAwVmkcUr48UL6FVB
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.
why
waitForDomNetworkQuiet()does not resolveframe.waitForLoadState()was not listening for the correct lifecycle events from CDP. instead of listening forDOMContentLoaded, it was listening fordomcontentloadedframe.waitForLoadState()did not accept a timeout parameterwaitForDomNetworkQuiet()did not include the call toframe.waitForLoadState()as part of the total time that it waits forwhat changed
frame.waitForLoadState()(fixes the first issue)frame.waitForLoadState()waitForDomNetworkQuiet(), I included the call toframe.waitForLoadState()as part of the total time that it waits fortest plan