{"id":23425,"library":"chrome-devtools-protocol","title":"Chrome DevTools Protocol","description":"Python type wrappers for Chrome DevTools Protocol (CDP). Provides typed classes and enums for all CDP domains. Current version 0.4.0, updated infrequently.","status":"active","version":"0.4.0","language":"python","source_language":"en","source_url":"https://github.com/hyperiongray/python-chrome-devtools-protocol","tags":["chrome","devtools","cdp","websocket"],"install":[{"cmd":"pip install chrome-devtools-protocol","lang":"bash","label":"Default install"}],"dependencies":[],"imports":[{"note":"Common mistake: trying to import from the package directly instead of 'cdp' module.","wrong":"import chrome_devtools_protocol.page.Page","symbol":"Page","correct":"from cdp.page import Page"},{"note":"Wrong module name.","wrong":"from chrome_debug import Network","symbol":"Network","correct":"from cdp.network import Network"}],"quickstart":{"code":"import asyncio\nfrom websockets import connect\nfrom cdp import Page, Network\n\nasync def main():\n    async with connect('ws://localhost:9222/devtools/browser/...') as ws:\n        # Send a Page.enable command\n        await ws.send(Page.enable())\n        # Receive response\n        response = await ws.recv()\n        print(response)\n\nasyncio.run(main())","lang":"python","description":"Connect to a CDP endpoint (e.g., Chrome debug port) and send a command."},"warnings":[{"fix":"Install 'websockets' and manage WebSocket lifecycle manually.","message":"The package does not manage WebSocket connections. You must handle the WebSocket yourself (e.g., using websockets library).","severity":"gotcha","affected_versions":"all"},{"fix":"Refer to the cdp.event_dispatch or use domain event classes directly (e.g., from cdp.page import Page.domContentEventFired).","message":"The 'event_parsers' module is deprecated; use message dispatch via domain events.","severity":"deprecated","affected_versions":"<=0.4.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'from cdp...' instead of 'from chrome_devtools_protocol...'.","cause":"Incorrect import path. The actual module is 'cdp', not the package name.","error":"ModuleNotFoundError: No module named 'chrome_devtools_protocol'"},{"fix":"Call the command as a function that returns a dict: `await ws.send(Page.enable())` sends a JSON string automatically.","cause":"Sending a CDP command class directly instead of calling its .to_json() method or using str().","error":"TypeError: Object of type Page is not JSON serializable"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}