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.
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 targetsessionId, so for example:fails with
CDP -32000: Method not available.Callingsession.setActiveSession(undefined)first makes the same Extensions command work.It looks like
isBrowserLevel()currently only special-casesBrowser.*andTarget.*. I tested a local one-line fix addingExtensions.*there, andExtensions.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.