Skip to content

Suppressed CDP logs and repeated locator setup add avoidable browser overhead #3239

Open

Description

@vishalanton16

Description

Repeated locator operations perform work that does not contribute to their results:

  • CDP debug payloads are serialized even when debug logs are suppressed.
  • Suppressed log entries still create tracing spans.
  • Locator calls repeatedly enable Runtime and DOM on the same session.
  • Filling a stable input resolves the same element again during preparation.

Reproduction

  1. Configure logging above debug level.
  2. Open a page containing a stable text input.
  3. Profile a repeated fill/read workload:
await page.goto(
  "data:text/html," + encodeURIComponent('<input id="value">'),
);

console.time("fills");
for (let index = 0; index < 100; index++) {
  await page.locator("#value").fill(String(index));
  await page.locator("#value").inputValue();
}
console.timeEnd("fills");
  1. Inspect a CPU profile and CDP call trace. For source-level verification, instrument JSON.stringify at the CDP logging call site, the logger's startSpan call, and session Runtime.enable / DOM.enable calls.

Actual behavior

Suppressed logging still performs serialization and span creation. Locator calls repeat successful domain setup, and fill resolves a stable input more than once.

In a separate local billing workload, removing this work reduced median browser CPU time from 50.82 s to 46.76 s and wall time from 11.44 s to 10.70 s. These workload-specific measurements are not expected timings for the small example above.

Expected behavior

Suppressed logs should avoid payload serialization and log-span creation. Internal locator calls should reuse successful session setup and the existing input handle when valid.

Explicit raw CDP commands must retain their behavior. Failed enables and explicit disables must allow setup to run again. Fill must recover when the page replaces the input and report failure if preparation cannot succeed.

Activity

  1. arunjmoorthy commented on Nov 8, 2026

    @arunjmoorthy

    Hi, I'm Arun from Stanford CS146S, and im claiming this issue.

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