Skip to content

Attached CDP HAR recording can miss popup first navigation #523

Open

Description

@tnunamak

A scenario HAR from an attached CDP browser can omit a sign-in popup's first navigation under load, even when the provider received the request. A missing popup request in the HAR alone cannot establish that the connector failed.

src/browser-launch.ts records the attached context through routeFromHAR(..., { update: true }). The original ownership fixture used window.open(providerUrl). Under CPU contention, its loopback server received /provider and the browser owner's client saw the request finish, but the recording client's HAR lacked it in 1 of 30 runs. A recorder-side probe reproduced the miss in 1 of 50 runs: the server count was one, the recording client logged no request or requestfinished events for /provider, and the HAR contained only the run page and owner tab. A passing control logged both request events. This places the observed miss at or before the attached client's network event capture, rather than at HAR export. PR #522 stabilizes the ownership test by opening a blank popup and navigating it after the popup event; real sign-in popups can still use window.open(providerUrl).

One candidate fix is a context-level CDP Network listener that captures new-target traffic and merges it into the HAR without duplicate entries. Another is Target.setAutoAttach with waitForDebuggerOnStart, which would pause popups until the recorder has attached. A regression test should use the original window.open(providerUrl) flow, verify the request reaches both server and HAR under contention, and preserve external browser page ownership.

The exact CDP/Patchright scheduling step that drops the recording client's event has not been traced.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions