Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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).

like image 703
Vier Avatar asked May 27 '19 13:05

Vier


People also ask

How do I use remote debugging port?

The Remote Debugger Port on 32-bit Operating Systems You can configure this from either the command line or the remote debugger window. In the remote debugger window, click Tools > Options, and set the TCP/IP port number. On the command line, start the remote debugger with the /port switch: msvsmon /port <port number>.

How do I run Chrome in debugging mode?

One can find this option in one of the following locations, depending on the Android version: Android 9 (API level 28) and higher: Settings > System > Advanced > Developer Options > USB debugging.

What is the default remote debugger port?

To debug on a remote IIS web server, open port 80 on the remote computer.


2 Answers

The issue is user-data-dir=.

You can point to your current profile directory, it may cause some problems. Debugging don't start without this argument.

On windows you can start as: C:\>"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe " --remote-debugging-port=9222 --user-data-dir=/temp'

From new versions, don't look anymore to http://localhost:9222/.

The correct way is open a new window and load chrome://inspect.
Any debugging instance will be show under devices list.

Chrome://inspect

like image 180
Luiz Vaz Avatar answered Oct 16 '22 14:10

Luiz Vaz


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/

like image 41
Vier Avatar answered Oct 16 '22 14:10

Vier