Obtaining a valid nodeId from a backendNodeId

14 views
Skip to first unread message

Dani Guardiola

unread,
Dec 12, 2023, 1:32:58 PM12/12/23
to Chrome DevTools
I'm losing my mind here and I'd appreciate some help getting this right.

I'm doing the following (pseudocode):

devTools.Overlay.setInspectMode({ mode: "searchForNode" })
(wait for "Overlay.inspectNodeRequested" event) -> backendNodeId
const { nodeIds } = await devTools.DOM.pushNodesByBackendIdsToFrontend({
  backendNodeIds: [backendNodeId],
});
devTools.CSS.getMatchedStylesForNode({ nodeId: nodeIds[0] })

When I do this, I get:
{"code":-32000,"message":"Could not find node with given id"}

Notes:

- I'm properly waiting for each RPC call to fully respond before executing the next step.
- There are no other errors.
- I get a non-zero backendNodeId.
- I get a non-zero nodeId that's different from backendNodeId.
- I don't think I'm doing anything weird other than this that could be a factor.
- I'm running this in a chrome extension through chrome.debugger.

Am I doing something stupid? Am I missing something? Thanks in advance.

Reply all
Reply to author
Forward
0 new messages