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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chromedeveloperprotocol_client-0.2.1.tar.gz | 250.5 kB | Without provenance | Details for chromedeveloperprotocol_client-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chromedeveloperprotocol_client-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for chromedeveloperprotocol_client-0.2.1-py3-none-any.whl |
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}
|
Security for chromedeveloperprotocol-client 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.