Skip to content

ref-based get commands break across normal CLI invocations in direct CDP mode #79

@ox01024

Description

@ox01024

Summary

In direct CDP mode, ref-based get commands are unreliable across normal CLI invocations.

Reproduction

Using the normal standalone CLI flow:

node dist/cli.js tab 3 --json
node dist/cli.js snapshot --json
node dist/cli.js get text 0 --json
node dist/cli.js get url --json
node dist/cli.js get title --json

Observed before fix:

  • the second process often fell back to the wrong tab (about:blank) because the selected target was only stored in-process
  • get text <ref> could fail with Unknown ref or return an empty string
  • get url / get title failed with Missing ref or attribute parameter

Root Cause

packages/cli/src/cdp-client.ts only tracked currentTargetId in memory, so a fresh CLI process lost the selected tab. On top of that:

  • get text tried to resolve text through a non-existent [data-bb-node-id=...] selector
  • get url / get title incorrectly required ref

Expected

Normal multi-invocation CLI usage should keep operating on the selected target, and get text|url|title should return the expected values without requiring a fresh snapshot or a bogus ref.

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