使用“remote-debugging-port”标志调试 Chrome 实例

Vie*_*ier 11 google-chrome google-chrome-devtools puppeteer

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\n 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\xe2\x80\x99t be reached" error page.

\n\n

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 .

\n\n

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.

\n\n

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

\n

Lui*_*Vaz 13

问题是user-data-dir=

您可以指向您当前的配置文件目录,这可能会导致一些问题。如果没有此参数,调试不会开始。

在 Windows 上,您可以这样启动: C:\>"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe " --remote-debugging-port=9222 --user-data-dir=/temp'

从新版本开始,不要再寻找http://localhost:9222/.

正确的方法是打开一个新窗口并加载chrome://inspect
任何调试实例都会显示在设备列表下。

Chrome://检查


Vie*_*ier 9

我设法通过启动 chrome 让它工作,如下所示:google-chrome --remote-debugging-port=9222 --user-data-dir=/home/whatever/Desktop/chrome/