feat: add --wait-until flag to open command and change default to domcontentloaded#480
Open
go-to-the-future wants to merge 1 commit intovercel-labs:mainfrom
Open
feat: add --wait-until flag to open command and change default to domcontentloaded#480go-to-the-future wants to merge 1 commit intovercel-labs:mainfrom
go-to-the-future wants to merge 1 commit intovercel-labs:mainfrom
Conversation
…contentloaded The open command now accepts --wait-until <strategy> to control when navigation is considered complete. Valid values: load, domcontentloaded, networkidle. Also configurable via AGENT_BROWSER_WAIT_UNTIL env var. The default wait strategy for handleNavigate is changed from load to domcontentloaded, aligning it with handleTabNew which already used domcontentloaded. The load event frequently times out on modern SPAs that load external scripts (analytics, auth providers), making it a poor default for agent workflows. Closes vercel-labs#479
Contributor
|
@go-to-the-future is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
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.
Summary
--wait-until <strategy>flag to theopencommand (load,domcontentloaded,networkidle)AGENT_BROWSER_WAIT_UNTILenvironment variablewaitUntilfromloadtodomcontentloadedinhandleNavigate, aligning it withhandleTabNewwhich already usesdomcontentloadedMotivation
The
loadevent waits for all resources (images, stylesheets, iframes, third-party scripts) to finish loading. On modern SPAs that depend on external auth providers, analytics, or other async resources, this frequently causes navigation timeouts — especially problematic for AI agent workflows where a timeout wastes an entire agent turn.domcontentloadedfires when the HTML is parsed and the DOM is ready, which is sufficient for most interactions. Agent workflows already follow anavigate → snapshot → interactpattern, so waiting for fullloadprovides no additional value.See also: Playwright docs recommend using lighter
waitUntilstrategies combined with element-based assertions for SPA testing.Changes
cli/src/flags.rswait_until: Option<String>field,--wait-untilflag parsing,clean_argssupport, env varAGENT_BROWSER_WAIT_UNTIL, and testscli/src/commands.rsflags.wait_untilaswaitUntilin the navigate JSON command, adddefault_flags()field, and 4 new testscli/src/output.rs--wait-untilinopenhelp, global options, and environment variablessrc/actions.tscommand.waitUntil ?? 'load'→command.waitUntil ?? 'domcontentloaded'Usage
Closes #479