Chrome Debugging Protocol interface that helps to instrument Chrome (or any other suitable implementation) by providing a simple abstraction of commands and notifications using a straightforward Python API.

This module is one of the many third-party protocol clients.

It is only for Python 3.5 for now

Sample API usage

The following snippet loads and prints every response body length:

import asyncio
import chrome_remote_interface

if __name__ == '__main__':
    class callbacks:
        async def start(tabs):
            await tabs.add()
        async def tab_start(tabs, tab):
            await tab.Page.enable()
            await tab.Network.enable()
            await tab.Page.navigate(url='')
        async def network__loading_finished(tabs, tab, requestId, **kwargs):
                body = tabs.helpers.old_helpers.unpack_response_body(await tab.Network.get_response_body(requestId=requestId))
                print('body length:', len(body))
            except tabs.FailResponse as e:
                print('fail:', e)
        async def page__frame_stopped_loading(tabs, tab, **kwargs):
        async def any(tabs, tab, callback_name, parameters):
            # print('Unknown event fired', callback_name)

    asyncio.get_event_loop().run_until_complete('localhost', 9222, callbacks))

We use these types of callbacks:

  • start(tabs) - fired on the start.
  • tab_start(tabs, tab, manual) - fired on tab create.
  • network__response_received(tabs, tab, **kwargs) - callback for chrome Network.responseReceived event.
  • any(tabs, tab, callback_name, parameters) - fallback which fired when there is no callback found.
  • tab_close(tabs, tab) - fired when tab is closed
  • tab_suicide(tabs, tab) - fired when tab is closed without your wish (and socket too)
  • close(tabs) - fired when all tabs are closed

We can add tab using method tabs.add() and remove it with tabs[n].remove() or tab.remove().

Each method can throw FailReponse exception when something goes wrong.

You can terminate your programm by calling tabs.terminate().


git clone
python3 install

Setup (all description from here)

An instance of either Chrome itself or another implementation needs to be running on a known port in order to use this module (defaults to localhost:9222).



Start Chrome with the --remote-debugging-port option, for example:

google-chrome --remote-debugging-port=9222

Since version 57, additionally use the --headless option, for example:

google-chrome --headless --remote-debugging-port=9222

Please note that currently the DevTools methods are not properly supported in headless mode; use the Target domain instead. See #83 and #84 for more information.


Plug the device and enable the port forwarding, for example:

adb forward tcp:9222 localabstract:chrome_devtools_remote

In order to be inspectable, a WebView must be configured for debugging and the corresponding process ID must be known. There are several ways to obtain it, for example:

adb shell grep -a webview_devtools_remote /proc/net/unix

Finally, port forwarding can be enabled as follows:

adb forward tcp:9222 localabstract:webview_devtools_remote_<pid>


Install and run the Edge Diagnostics Adapter.


Start Node.js with the --inspect option, for example:

node --inspect=9222 script.js

Safari (iOS)

Install and run the iOS WebKit Debug Proxy.

Chrome Debugging Protocol versions

You can update it using this way (It will be downloaded automatically first time)

import chrome_remote_interface

Protocols are loaded from here and here




Chrome Debugging Protocol interface for Python

Chrome_remote_interface_python Info

⭐ Stars 95
🔗 Source Code
🕒 Last Update a year ago
🕒 Created 4 years ago
🐞 Open Issues 0
➗ Star-Issue Ratio Infinity
😎 Author wasiher