title: Runtime.consoleAPICalled callback stops when open Chrome devtools
body: <p>I am developing web automation system using Chrome and Chrome DevTools Protocol (<a href="https://chromedevtools.github.io/devtools-protocol/" rel="nofollow noreferrer">https://chromedevtools.github.io/devtools-protocol/</a>) in Nodejs.</p>
  
  <p>Calling the Runtime.consoleAPICalled method works fine, but when I open devtools of the launched Chrome, it no longer works.</p>
  
  <p>How do I get the API to be called regardless of Chrome devtools?</p>
  
  <pre class="lang-js prettyprint-override"><code>const CDP = require('chrome-remote-interface');
  const chromeLauncher = require('chrome-launcher');
  
  (async function launch() {
      const chrome = await chromeLauncher.launch({
          port: 9222,
          chromeFlags: [
              '--window-size=1024,768',
              '--disable-gpu'
          ]
      });
      const protocol = await CDP({ port: chrome.port });
      const { Page } = protocol;
      const { Runtime } = protocol;
  
      await Page.enable();
      await Runtime.enable();
  
      Runtime.consoleAPICalled(function(params) {
          // Not working when I open Chrome devtools.
          console.log('Runtime.consoleAPICalled', params);
      });
  
      Page.loadEventFired(async() =&gt; {
          await Runtime.evaluate({
              "expression": `
                  setInterval(function () {
                      console.log(new Date());
                  }, 1000);
              `
          });
      });
  
      Page.navigate({
          url: 'https://www.google.com'
      });
  })();
  </code></pre>