ChromeDevTools / ChromeDevTools/chrome-devtools-mcp

list_network_requests misses navigation requests in tabs opened via window.open

Open
#2,395 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

confirmed feature
Dominant language
TypeScript
Stars
52.3k
Forks
4.3k
Avg merge
2d 7h
Merged PRs (30d)
83

Description

Is your feature request related to a problem? Please describe.

Description of the feature

When a page opens a new tab itself (window.open / target=_blank from a click handler), list_network_requests on that tab returns nothing — the entire navigation, redirect chain included, is missed. includePreservedRequests: true doesn't help; nothing was ever recorded. Quiet failure: an empty listing reads as "this tab made no requests".

Cause: new targets are wired reactively (McpContext.tstargetcreatedawait target.page()void #createMcpPage(page)), so the popup navigates before the collector's Network.enable lands. And unlike console messages (#2382), Chromium doesn't replay network events to late CDP sessions, so there's nothing to backfill.

Reproduction

  1. new_page

    data:text/html,<a href="#" onclick="window.open('https://httpbingo.org/redirect-to?url=https%253A%252F%252Fexample.com%252F','_blank');return false;">OPEN</a>
    
  2. take_snapshot, click the link

  3. list_pages → the popup is there, already landed on https://example.com/ (redirect chain completed)

  4. select_page the popup, list_network_requests with includePreservedRequests: true → empty

Sanity check: navigate that same popup anywhere afterwards and the request shows up fine — capture works, it just started too late.

Describe the solution you'd like

Expectation

Requests in opened tabs are captured from the first request. Since CDP offers no replay for Network events, the reliable shape seems to be pausing new targets until the collector is wired: Target.setAutoAttach with waitForDebuggerOnStart: true, enable Network on attach, then Runtime.runIfWaitingForDebugger.

Proposal

The proposed solution is to hold old new targets until the collector is wired: browser-level Target.setAutoAttach with waitForDebuggerOnStart: true, enable Network on attach, then Runtime.runIfWaitingForDebugger. The pause is a few milliseconds per new tab.

Enabling it could work like this:

  • a server flag, e.g. --captureNewTabs, enabling pause-and-wire globally; or
  • a runtime tool to arm it on demand
Describe alternatives you've considered
  • includePreservedRequests — doesn't apply: it preserves already-captured requests across navigations, and here nothing was ever captured.
  • --chromeArg=--auto-open-devtools-for-tabs — verified, no effect: the held first navigation feeds the DevTools frontend's own CDP session, not the server's.
  • External sidecar: a second CDP client that arms setAutoAttach itself and logs Network events (our current workaround), but lives outside the server and its capture is invisible to list_network_requests, so results come from two sources.
Additional context

Context: we run browser-ground-truth tests, where verifying click → redirect chain → landing is the whole point. The chain start is exactly the part that's lost.

Chrome DevTools MCP version

1.6.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in McpContext.ts at the targetcreated handler and follow await target.page() into #createMcpPage and network collector setup. Review the proposed Target.setAutoAttach, waitForDebuggerOnStart, Network.enable, and Runtime.runIfWaitingForDebugger flow. Done means list_network_requests captures the popup's initial request and redirect chain, including when the tab opens via window.open or target=_blank.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
devtools, networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.