CDP Use is a Python client generator for the Chrome DevTools Protocol (CDP). It reads the official protocol specifications and generates typed Python bindings, so every CDP command, parameter, return value, and event carries TypedDict type hints and IDE autocompletion.
You connect with CDPClient over a DevTools WebSocket URL and send commands through client.send. . (), for example cdp.send.Page.navigate({"url": ...}). Event handlers register through client.register. . (callback), where each callback receives the typed event payload and a session ID; misnamed parameters or wrong callback signatures surface as type errors during development.
Running python -m cdp_use.generator downloads the latest protocol files, generates types, commands, events, and registration classes for each of the 50+ CDP domains, and formats the output. You can pin the generator to a specific commit of the protocol repository.
Features
- Typed commands: TypedDict parameter and return types for every CDP command
- Typed events: per-event interfaces and type-checked handler signatures across Page, Runtime, Network, DOM, CSS, Debugger, Performance, Security, and other domains
- Generated from spec: bindings are produced directly from the Chrome DevTools Protocol repository
- Domain modules: separate types, commands, events, library, and registration modules per domain
- Regeneration: a single generator command refreshes bindings from the latest or a pinned protocol version
- Async client: an asyncio-based WebSocket client with context-manager lifecycle
