官网:
https://chromedevtools.github.io/devtools-protocol/
https://developer.chrome.com/extensions/debugger
chrome.exe --remote-debugging-port=9222 Then you can start a separate client Chrome instance, using a distinct user profile: chrome.exe --user-data-dir=<some directory>
Now you can navigate to the given port from your client and attach to any of the discovered tabs for debugging: http://localhost:9222
You will find the Developer Tools interface identical to the embedded one and here is why:
- When you navigate your client browser to the remote's Chrome port, Developer Tools front-end is being served from the host Chrome as a Web Application from the Web Server.
- It fetches HTML, JavaScript and CSS files over HTTP
- Once loaded, Developer Tools establishes a Web Socket connection to its host and starts exchanging JSON messages with it.
In this scenario, you can substitute Developer Tools front-end with your own implementation. Instead of navigating to the HTML page at http://localhost:9222, your application can discover available pages by requesting: http://localhost:9222/json and getting a JSON object with information about inspectable pages along with the WebSocket addresses that you could use in order to start instrumenting them. See the HTTP Endpoints section below for more.