title: Using Chrome DevTools Protocol Input.dispatchKeyEvent or Input.dispatchMouseEvent to send an event
body: <p>I'm writing a DSL that will interact with a page via Google Chrome's Remote Debugging API.</p>
  
  <p>The INPUT domain (link here:
  <a href="https://chromedevtools.github.io/devtools-protocol/1-2/Input/" rel="nofollow noreferrer">https://chromedevtools.github.io/devtools-protocol/1-2/Input/</a>) lists two functions that can be used for sending events: <strong>Input.dispatchKeyEvent</strong> and <strong>Input.dispatchMouseEvent</strong>.</p>
  
  <p>I can't seem to figure out how to specify the target <code>element</code> as there is no link between the two functions and <code>DOM.NodeId</code>, or an intermediate API that accepts a <code>DOM.NodeId</code> which then returns an X,Y co-ordinate.</p>
  
  <p>I know that it's possible to use Selenium, but I'm interested in doing directly using WebSockets.</p>
  
  <p>Any help is appreciated.</p>