Finally got it working, just need this 1 command-
ws.send(JSON.stringify({
id: 1,
method: 'DOM.getDocument',
params: { depth: -1, pierce: true }
}));
Even DOM.enable
isn't needed.
The documentation for DOM.getDocument
says -
Returns the root DOM node (and optionally the subtree) to the caller. Implicitly enables the DOM domain events for the current target.
I was assuming that DOM.enable
was the explicit way of enabling DOM domain events, and so I kept calling it, but it looks like DOM.getDocument
is special. Not sure if this is a bug or not.