ConnectionHandler

pydoll · automation, websocket, cdp, connection-lifecycle, dev-tools

Manages WebSocket connections to Chrome DevTools Protocol endpoints, handling command execution, event subscription, and connection lifecycle for browser automation.

# Source: https://github.com/autoscrape-labs/pydoll | License: MIT | Copyright 2025 AutoscrapeLabs
# Provided via justclaw.it.com; keep this notice with the code.
class ConnectionHandler:
    """
    WebSocket connection manager for Chrome DevTools Protocol endpoints.

    Handles connection lifecycle, command execution, and event subscription
    for both browser-level and page-level CDP endpoints.
    """

    def __init__(
        self,
        connection_port: Optional[int] = None,
        page_id: Optional[str] = None,
        ws_address_resolver: Callable[[int], Coroutine[Any, Any, str]] = get_browser_ws_address,
        ws_connector: type[Connect] = websockets.connect,
        ws_address: Optional[str] = None,
    ):
        """
        Initialize connection handler.

        Args:


... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key