Skip to content

Extensions.* commands are routed through the active target session #4

Description

@ZJHSteven

Hi! I ran into this while using browser-harness-js against Chrome 151 on Windows.

After selecting a page with session.use(targetId), browser-level extension commands are sent with the active target sessionId, so for example:

await session.connect({ wsUrl })
const tabs = await listPageTargets()
await session.use(tabs[0].targetId)
await session.Extensions.getExtensions()

fails with CDP -32000: Method not available. Calling session.setActiveSession(undefined) first makes the same Extensions command work.

It looks like isBrowserLevel() currently only special-cases Browser.* and Target.*. I tested a local one-line fix adding Extensions.* there, and Extensions.getExtensions() then works while a page session remains active.

Would you be open to that small fix? Happy to send a focused PR if useful.

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