Skip to content

feat: add --wait-until flag and change default to domcontentloaded#662

Open
juliobrasa wants to merge 1 commit intovercel-labs:mainfrom
juliobrasa:feat/wait-until-flag
Open

feat: add --wait-until flag and change default to domcontentloaded#662
juliobrasa wants to merge 1 commit intovercel-labs:mainfrom
juliobrasa:feat/wait-until-flag

Conversation

@juliobrasa
Copy link

Summary

The open command defaulted to waitUntil: 'load', which waits for all resources (analytics, third-party scripts, etc.) and frequently causes timeouts on modern SPAs.

Changes

  1. Add --wait-until CLI flag — accepts load, domcontentloaded, or networkidle
  2. Change default to domcontentloaded — for both handleNavigate and handleDiffUrl
  3. Align with tab new — which already used domcontentloaded
  4. Env var supportAGENT_BROWSER_WAIT_UNTIL

Usage

agent-browser open https://example.com                           # uses domcontentloaded
agent-browser open https://example.com --wait-until load         # wait for all resources
agent-browser open https://example.com --wait-until networkidle  # wait for network idle

Files changed

  • cli/src/flags.rs — add wait_until field + --wait-until parsing
  • cli/src/commands.rs — pass waitUntil in navigate JSON command
  • src/actions.ts — change default from load to domcontentloaded

Test plan

  • Rust compiles without errors
  • TypeScript compiles without errors
  • open <url> completes faster on SPA sites
  • open <url> --wait-until load preserves old behavior

Closes #479

🤖 Generated with Claude Code

The `open` command previously defaulted to `waitUntil: 'load'`, which
waits for all resources (images, analytics, third-party scripts) to
finish loading. This frequently causes timeouts on modern SPAs.

Changes:
- Add `--wait-until` CLI flag accepting `load`, `domcontentloaded`,
  or `networkidle`
- Change default from `load` to `domcontentloaded` for both
  `handleNavigate` and `handleDiffUrl`
- Aligns with `tab new` which already used `domcontentloaded`
- Flag can also be set via AGENT_BROWSER_WAIT_UNTIL env var

Usage:
  agent-browser open https://example.com --wait-until load
  agent-browser open https://example.com --wait-until networkidle

Closes vercel-labs#479

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link
Contributor

vercel bot commented Mar 6, 2026

Someone is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Suggestion:

Native Rust daemon defaults to WaitUntil::Load for navigate and diff_url commands, while the Node.js daemon was changed to default to 'domcontentloaded', causing inconsistent behavior between the two daemon implementations.

Fix on Vercel

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.

Add --wait-until flag to open command and change default to domcontentloaded

1 participant