Skip to main content

CDP Client

Python wrapper for Chrome DevTools Protocol.

Installation

pip install chromedeveloperprotocol-client

Usage

This example shows how to connect to a running browser and fetch its version information.

Hello World Example

import asyncio
import httpx
from cdp import Client

async def get_ws_url(port=9222):
    async with httpx.AsyncClient() as http:
        resp = await http.get(f"http://localhost:{port}/json/version")
        return resp.json()['webSocketDebuggerUrl']

async def main():
    # Connect to an existing browser session
    # Browser must be started with --remote-debugging-port=9222
    ws_url = await get_ws_url()
    
    async with Client(ws_url) as client:
        # Fetch browser version information
        version = await client.browser.get_version({})
        print(f"Browser: {version['product']}")
        
        # Create a new page and navigate
        target = await client.target.create_target({"url": "https://www.google.com"})
        print(f"Created target: {target['targetId']}")

if __name__ == "__main__":
    asyncio.run(main())

Running the Examples

Ensure you have a browser (Chrome or Edge) running with remote debugging enabled:

chrome.exe --remote-debugging-port=9222

Updating the CDP Protocols

The library automatically generates its protocol definitions from the upstream ChromeDevTools/devtools-protocol repository during build/installation.

To fetch the latest protocol definitions and update the client code, run:

uv sync --reinstall-package chromedeveloperprotocol-client

This will trigger the build hook which pulls the latest JSON files and regenerates the src/cdp directory.

Metadata

Release files for chromedeveloperprotocol-client 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chromedeveloperprotocol-client 0.2.1
File Size Uploaded
chromedeveloperprotocol_client-0.2.1.tar.gz 250.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for chromedeveloperprotocol-client 0.2.1
File Interpreter ABI Platform
chromedeveloperprotocol_client-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 639.6 kB

Release files / chromedeveloperprotocol_client-0.2.1.tar.gz

Download URL chromedeveloperprotocol_client-0.2.1.tar.gz
Size 250.5 kB
Tags Source
SHA-256 checksum
How to use checksums
671131d436cc4d217fec0f6f1762d36cd4baec03eaaeb070f169be4ae915145d
BLAKE2b-256 checksum
How to use checksums
cd4b8bfd4e0352cf2f5de3f38d35c6a684e5ff0fcb71a2499678f73e3e16556f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / chromedeveloperprotocol_client-0.2.1-py3-none-any.whl

Download URL chromedeveloperprotocol_client-0.2.1-py3-none-any.whl
Size 389.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4b213dc2db97a5ee6aaee47b7ac69899d07ceaa1bec196e2880f8857d4134be3
BLAKE2b-256 checksum
How to use checksums
438866d74b2e223abc3abc0d445949f808e5a143dab06b20d591de9d1cbd6487
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page