CDP-Use is a type-safe Python client library for the Chrome DevTools Protocol (CDP). It provides auto-generated, strongly-typed commands and events, allowing for interaction with browsers like Chrome and Edge, or browser automation tools like Playwright and Puppeteer. It is actively maintained with regular releases, currently at version 1.4.5.
pip install cdp-useVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to connect to a browser's CDP endpoint, navigate to a URL, and fetch some basic page information. Ensure you have a browser running with remote debugging enabled (e.g., `chrome --remote-debugging-port=9222`).
Update imports from `cdp_py` to `cdp_use` and refactor code to match the new API design. Refer to the `cdp-use` documentation for the updated API.
Ensure your browser is launched with `--remote-debugging-port=<port>` (e.g., `chrome --remote-debugging-port=9222`) or that your browser automation setup (Playwright, Puppeteer) exposes a CDP endpoint.
Always instantiate and manage the `CDP` client using `async with CDP(Target(...)) as cdp:` within an `async` function.