Skip to content

fix: capture all network requests including document navigations#663

Open
juliobrasa wants to merge 1 commit intovercel-labs:mainfrom
juliobrasa:fix/network-requests-capture-navigations
Open

fix: capture all network requests including document navigations#663
juliobrasa wants to merge 1 commit intovercel-labs:mainfrom
juliobrasa:fix/network-requests-capture-navigations

Conversation

@juliobrasa
Copy link

Summary

network requests only captured XHR/fetch calls because request tracking was activated on-demand when the user first ran the command. Navigations occurring before that call were never recorded.

Root cause

startRequestTracking() registered a page.on('request') listener only when called explicitly. Document navigations (page loads, redirects, form submissions) that occurred before the user ran network requests were invisible.

Fix

Move request tracking into setupPageTracking() so it is always active for every page from creation. This captures all network activity:

  • Document navigations
  • Redirect chains (3xx)
  • Resource loads (scripts, stylesheets, images)
  • XHR/fetch (as before)

startRequestTracking() is kept as a no-op for backwards compatibility.

Before

agent-browser open https://example.com
agent-browser click @e1  # navigates to /other-page
agent-browser network requests
# (empty)

After

agent-browser open https://example.com
agent-browser click @e1  # navigates to /other-page
agent-browser network requests
# GET https://example.com/other-page (document)

Test plan

  • TypeScript compiles without errors
  • network requests captures document navigations
  • network requests --filter still works for filtering

Closes #555

🤖 Generated with Claude Code

Previously, `network requests` only captured XHR/fetch because request
tracking was only activated on-demand via `startRequestTracking()`,
which was called when the user first ran `network requests`. This meant
navigations that occurred before that call were never recorded.

Fix: move request tracking into `setupPageTracking()` so it is always
active for every page from the moment it is created. This captures all
network activity including document navigations, redirects, and resource
loads — not just XHR/fetch.

`startRequestTracking()` is kept as a no-op for backwards compatibility.

Closes vercel-labs#555

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.

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.

[Bug] network requests does not capture page navigations — only XHR/fetch (distinct from #130)

1 participant