Skip to content

Protocol Base Types

Base types and structures for Chrome DevTools Protocol commands, responses, and events.

Base Types

pydoll.protocol.base

T_CommandParams module-attribute

T_CommandParams = TypeVar('T_CommandParams')

T_CommandResponse module-attribute

T_CommandResponse = TypeVar('T_CommandResponse')

T_EventParams module-attribute

T_EventParams = TypeVar('T_EventParams')

EmptyParams

Bases: TypedDict

Empty parameters for commands.

EmptyResponse

Bases: TypedDict

Empty response for commands.

Command

Bases: TypedDict, Generic[T_CommandParams, T_CommandResponse]

Base structure for all commands.

ATTRIBUTE DESCRIPTION
method

The command method name

TYPE: str

params

Optional dictionary of parameters for the command

TYPE: NotRequired[T_CommandParams]

sessionId

Optional target session identifier (flattened sessions)

TYPE: NotRequired[str]

id instance-attribute
id
method instance-attribute
method
params instance-attribute
params
sessionId instance-attribute
sessionId

ResponseError

Bases: TypedDict

Error payload the browser sends in place of a result.

ATTRIBUTE DESCRIPTION
code

JSON-RPC style error code (-32000 for domain errors, -32601 unknown method...)

TYPE: int

message

Human readable reason

TYPE: str

data

Optional extra detail attached by the browser

TYPE: NotRequired[str]

code instance-attribute
code
message instance-attribute
message
data instance-attribute
data

Response

Bases: TypedDict, Generic[T_CommandResponse]

Base structure for all responses.

Exactly one of result or error is present for a given command id.

ATTRIBUTE DESCRIPTION
id

The ID that matches the command ID

TYPE: int

result

The result data for the command

TYPE: T_CommandResponse

error

Error payload when the browser rejected the command

TYPE: NotRequired[ResponseError]

sessionId

Optional target session identifier (flattened sessions)

TYPE: NotRequired[str]

id instance-attribute
id
result instance-attribute
result
error instance-attribute
error
sessionId instance-attribute
sessionId

CDPEvent

Bases: TypedDict, Generic[T_EventParams]

Base structure for all events.

method instance-attribute
method
params instance-attribute
params
sessionId instance-attribute
sessionId