Skip to main content

Chrome Debugging Protocol client

Project description

CProto is a Debugging Protocol client that supports Chrome, Chromium and Blink based browsers.

CProto provides you an advanced interface to interact with Chrome (or another supported browser) instance from your Python code. It’s greatly useful for automated testing, debugging, profiling or even complicated page crawling.

This project is under development. More updates are coming soon.

Getting Started

Installing CProto

Python 2.7 or 3.3+ is required to install CProto.

Install the latest version using pip:

$ pip install cproto

Running Chrome in Debug mode

Option 1: Run Chrome in Docker, also in Headless mode.

Option 2: Run Chrome on host machine:

# «chrome» should point to your installation of Chrome
chrome --remote-debugging-port=9222 "about:blank"

# If you haven't created alias for Chrome yet, you could set it on MacOS like that:
# For Chrome
alias chrome="/Applications/Google\\ Chrome"
# For Chrome Canary
alias chrome-canary="/Applications/Google\ Chrome\\ Chrome\ Canary"
# For Chromium
alias chromium="/Applications/"

API Docs

Chrome Debugging Protocol documentation.

CProto complies to official Chrome Debugging Protocol, which implicates CProto’s interface has the same API as Chrome Debugging Protocol. Consider this example:

from cproto import CProto

# Print event's response and close CProto connection
def on_load(response):

# Create CProto instance and connect to a browser over CDP
cp = CProto(host='', port=9222)
# Enable Page domain events
# Adds Page callback that's fired after is loaded
cp.Page.loadEventFired = on_load
# Navigate browser to Github

In this example Page Domain API was used to navigate to any arbitrary URL. There are a whole bunch of other methods and events available for each Domain, you could browse all of them on the CDP documentation website.


  • [x] Domains support
  • [x] Methods support
  • [x] Events support
  • [ ] Types support
  • TBA – suggestions are welcome

Chrome Headless

While Chrome Headless mode is only available for Linux (MacOS coming soon), you could use Docker to run Headless mode on any major OS.

# Build Docker image for Chrome Headless:
$ docker build -t headless .

# Run Docker Chrome Headless mode container with port 9222 being proxied to the host machine:
$ docker run --rm -it --cap-add=SYS_ADMIN -p 9222:9222 headless

# That's all here. Chrome Debugging interface is now listening for connections.
# You could check it out by opening this link in your browser – http://localhost:9222.


Check out examples directory.

More examples are coming soon.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
cproto-0.6.0-py2.py3-none-any.whl (69.2 kB) Copy SHA256 hash SHA256 Wheel py2.py3
cproto-0.6.0.tar.gz (64.1 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page