Remote debugging with Chrome Developer Tools

Monday, May 09, 2011

Labels:

Google Chrome Developer Tools (or DevTools) front-end is implemented as an HTML + CSS + JavaScript web application. It uses a serialized message channel in order to communicate with the inspected page. Originally, we were working on establishing this serialized asynchronous interaction in order to bring DevTools front-end out of the inspected page process. But once it was done, we could take it even further and run DevTools front-end outside the browser. Here is how you can give it a try:

  • Run the Chrome instance that you will be debugging remotely with the remote debugging command line switch: chrome.exe --remote-debugging-port=9222 --user-data-dir=remote-profile. It is essential that you use a different instance of Chrome for the remote session and that is why we run it with the --user-data-dir argument.
  • Navigate to the pages you intend to debug.
  • Now run a regular (client) Chrome instance and navigate to http://localhost:9222 there.
You will see a number of links that will bring you to the remote debugging sessions for the corresponding pages. Click them and enjoy debugging your Chrome pages over the wire:


We implemented the remote debugging infrastructure in the WebKit repository (or as we say “upstream”), so that other WebKit port owners could expose remote debugging capabilities with a minimal effort. See more information on remote debugging in our WebKit blog post. For more information on the remote debugging and Chrome Developer Tools in general, see our documentation page.

4 comments:

The MAZZTer said...

You can also run Stable/Beta/Dev channel as the server and Canary channel as the client. No need for user-data-dir then.

Or actually run it remotely from another machine.

Andrew said...

Now if you could just inspect IE remotely via Chrome....

ralf2511 said...

Please add the "Selenium RC"
http://seleniumhq.org/projects/remote-control/
Command Set!
Than you do not need an extra Selenium RC server and you can automatically test pages with Selenium scripts.

Ahmad M. Zawawi said...

I noticed that you cannot actually debug it from another machine since the remote debugging socket is bound to 127.0.0.1:9222 instead of 0.0.0.0:9222. Is there a way to remove that restriction?