ChromeDevTools / devtools-protocol

Chrome DevTools Protocol
https://chromedevtools.github.io/devtools-protocol/
BSD 3-Clause "New" or "Revised" License
1.15k stars 226 forks source link

"Getting started" and "Basics" in the documentation not working #286

Closed adriancch-inditex closed 9 months ago

adriancch-inditex commented 2 years ago

I reported this issue here, but I'm not 100% sure if that was the correct place so I'm referencing it in this repository too. If you think this is NOT the correct place, feel free to close this issue.

Environment

Component Version Node.js N/A Client (Chrome/Chromium/...) Chrome Version 105.0.5195.127 OS running Node.js N/A OS running the client Windows 10 Pro (Version 21H2, OS build 19044.2006) chrome-remote-interface N/A Is the client running in a container? NO

Description

In https://chromedevtools.github.io/devtools-protocol/, in th "Resources" section there is a link: Getting Started with CDP. This link points to a README.md file in another repository that says the following:

Protocol Fundamentals

When Chromium is started with a --remote-debugging-port=0 flag, it starts a Chrome DevTools Protocol server and prints its WebSocket URL to STDERR. The output looks something like this:

DevTools listening on ws://127.0.0.1:36775/devtools/browser/a292f96c-7332-4ce8-82a9-7411f3bd280a

However, running the command chrome.exe --remote-debugging-port=0 doesn't output anything.

Also, in Basics: Using DevTools as protocol client it says that if you run chrome.exe --remote-debugging-port=9222 then you should be able to open http://localhost:9222/ with a web browser, but when I do I don't see anything. It's just a blank page.

Example

N/A

adriancch-inditex commented 2 years ago

According to what "cyrus-and" said:

Also, in Basics: Using DevTools as protocol client it says that if you run chrome.exe --remote-debugging-port=9222 then you should be able to open http://localhost:9222/ with a web browser, but when I do I don't see anything. It's just a blank page.

Yes this used to be the case. Now I think that page has been removed, now you can just navigate to chrome://inspect. In any case, it doesn't matter if you're going to instrument the instance with JavaScript.

Hope it helps!

Would you mind to reflect that in the documentation?

deltaidea commented 8 months ago

Solution: add --enable-logging to see the WebSocket URL in your terminal.

I found this issue in search results but ended up having to dig in Chromium source code, so hopefully this might save some time for others in the future. :)