Search code examples
google-chromegoogle-chrome-devtoolspuppeteer

Debugging a Chrome instance with "remote-debugging-port" flag


I'm trying to follow the steps described under Basics: Using DevTools as protocol client on https://chromedevtools.github.io/devtools-protocol/. I launch two Chrome instances with google-chrome --remote-debugger-port=9222 and google-chrome --user-data-dir=/home/whatever/Desktop/chrome/. After that, I navigate to http://127.0.0.1:9222/ but I get a "This site can’t be reached" error page.

If instead of this I launch Chrome with google-chrome --headless --remote-debugging-port=9222, when I navigate to http://127.0.0.1:9222/ I can see "Inspectable WebContents" and a link to a blank page .

Anyone has an idea on why the remote-debugging-port flag is only working with a headless instance? From what i can understand it should work both ways.

Note: What I'm attempting is to be able to use Puppeteer on a Chorme instance using the connect method (https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerconnectoptions).


Solution

  • I managed to get it to work by launching chrome as following: google-chrome --remote-debugging-port=9222 --user-data-dir=/home/whatever/Desktop/chrome/