79358124

Date: 2025-01-15 11:59:58
Score: 0.5
Natty:
Report link

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.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: SS221