Skip to content

目标协议

Chrome DevTools 协议的目标域命令、事件和类型。

方法

pydoll.protocol.target.methods

AttachToTargetResponse module-attribute

AttachToTargetResponse = Response[AttachToTargetResult]

AttachToBrowserTargetResponse module-attribute

AttachToBrowserTargetResponse = Response[AttachToBrowserTargetResult]

CloseTargetResponse module-attribute

CloseTargetResponse = Response[CloseTargetResult]

CreateBrowserContextResponse module-attribute

CreateBrowserContextResponse = Response[CreateBrowserContextResult]

GetBrowserContextsResponse module-attribute

GetBrowserContextsResponse = Response[GetBrowserContextsResult]

CreateTargetResponse module-attribute

CreateTargetResponse = Response[CreateTargetResult]

GetTargetInfoResponse module-attribute

GetTargetInfoResponse = Response[GetTargetInfoResult]

GetTargetsResponse module-attribute

GetTargetsResponse = Response[GetTargetsResult]

OpenDevToolsResponse module-attribute

OpenDevToolsResponse = Response[OpenDevToolsResult]

ActivateTargetCommand module-attribute

ActivateTargetCommand = Command[ActivateTargetParams, EmptyResponse]

AttachToTargetCommand module-attribute

AttachToBrowserTargetCommand module-attribute

AttachToBrowserTargetCommand = Command[EmptyParams, AttachToBrowserTargetResponse]

CloseTargetCommand module-attribute

ExposeDevToolsProtocolCommand module-attribute

ExposeDevToolsProtocolCommand = Command[ExposeDevToolsProtocolParams, EmptyResponse]

CreateBrowserContextCommand module-attribute

GetBrowserContextsCommand module-attribute

GetBrowserContextsCommand = Command[EmptyParams, GetBrowserContextsResponse]

CreateTargetCommand module-attribute

DetachFromTargetCommand module-attribute

DetachFromTargetCommand = Command[DetachFromTargetParams, EmptyResponse]

DisposeBrowserContextCommand module-attribute

DisposeBrowserContextCommand = Command[DisposeBrowserContextParams, EmptyResponse]

GetTargetInfoCommand module-attribute

GetTargetsCommand module-attribute

SendMessageToTargetCommand module-attribute

SendMessageToTargetCommand = Command[SendMessageToTargetParams, EmptyResponse]

SetAutoAttachCommand module-attribute

SetAutoAttachCommand = Command[SetAutoAttachParams, EmptyResponse]

AutoAttachRelatedCommand module-attribute

AutoAttachRelatedCommand = Command[AutoAttachRelatedParams, EmptyResponse]

SetDiscoverTargetsCommand module-attribute

SetDiscoverTargetsCommand = Command[SetDiscoverTargetsParams, EmptyResponse]

SetRemoteLocationsCommand module-attribute

SetRemoteLocationsCommand = Command[SetRemoteLocationsParams, EmptyResponse]

OpenDevToolsCommand module-attribute

TargetMethod

Bases: str, Enum

Target domain method names.

ACTIVATE_TARGET class-attribute instance-attribute

ACTIVATE_TARGET = 'Target.activateTarget'

ATTACH_TO_TARGET class-attribute instance-attribute

ATTACH_TO_TARGET = 'Target.attachToTarget'

ATTACH_TO_BROWSER_TARGET class-attribute instance-attribute

ATTACH_TO_BROWSER_TARGET = 'Target.attachToBrowserTarget'

CLOSE_TARGET class-attribute instance-attribute

CLOSE_TARGET = 'Target.closeTarget'

EXPOSE_DEV_TOOLS_PROTOCOL class-attribute instance-attribute

EXPOSE_DEV_TOOLS_PROTOCOL = 'Target.exposeDevToolsProtocol'

CREATE_BROWSER_CONTEXT class-attribute instance-attribute

CREATE_BROWSER_CONTEXT = 'Target.createBrowserContext'

GET_BROWSER_CONTEXTS class-attribute instance-attribute

GET_BROWSER_CONTEXTS = 'Target.getBrowserContexts'

CREATE_TARGET class-attribute instance-attribute

CREATE_TARGET = 'Target.createTarget'

DETACH_FROM_TARGET class-attribute instance-attribute

DETACH_FROM_TARGET = 'Target.detachFromTarget'

DISPOSE_BROWSER_CONTEXT class-attribute instance-attribute

DISPOSE_BROWSER_CONTEXT = 'Target.disposeBrowserContext'

GET_TARGET_INFO class-attribute instance-attribute

GET_TARGET_INFO = 'Target.getTargetInfo'

GET_TARGETS class-attribute instance-attribute

GET_TARGETS = 'Target.getTargets'

SEND_MESSAGE_TO_TARGET class-attribute instance-attribute

SEND_MESSAGE_TO_TARGET = 'Target.sendMessageToTarget'

SET_AUTO_ATTACH class-attribute instance-attribute

SET_AUTO_ATTACH = 'Target.setAutoAttach'
AUTO_ATTACH_RELATED = 'Target.autoAttachRelated'

SET_DISCOVER_TARGETS class-attribute instance-attribute

SET_DISCOVER_TARGETS = 'Target.setDiscoverTargets'

SET_REMOTE_LOCATIONS class-attribute instance-attribute

SET_REMOTE_LOCATIONS = 'Target.setRemoteLocations'

OPEN_DEV_TOOLS class-attribute instance-attribute

OPEN_DEV_TOOLS = 'Target.openDevTools'

ActivateTargetParams

Bases: TypedDict

Parameters for the activateTarget command.

targetId instance-attribute

targetId

AttachToTargetParams

Bases: TypedDict

Parameters for the attachToTarget command.

targetId instance-attribute

targetId

flatten instance-attribute

flatten

AttachToBrowserTargetParams

Bases: TypedDict

Parameters for the attachToBrowserTarget command.

sessionId instance-attribute

sessionId

CloseTargetParams

Bases: TypedDict

Parameters for the closeTarget command.

targetId instance-attribute

targetId

ExposeDevToolsProtocolParams

Bases: TypedDict

Parameters for the exposeDevToolsProtocol command.

targetId instance-attribute

targetId

bindingName instance-attribute

bindingName

inheritPermissions instance-attribute

inheritPermissions

CreateBrowserContextParams

Bases: TypedDict

Parameters for the createBrowserContext command.

disposeOnDetach instance-attribute

disposeOnDetach

proxyServer instance-attribute

proxyServer

proxyBypassList instance-attribute

proxyBypassList

originsWithUniversalNetworkAccess instance-attribute

originsWithUniversalNetworkAccess

CreateTargetParams

Bases: TypedDict

Parameters for the createTarget command.

url instance-attribute

url

left instance-attribute

left

top instance-attribute

top

width instance-attribute

width

height instance-attribute

height

windowState instance-attribute

windowState

browserContextId instance-attribute

browserContextId

enableBeginFrameControl instance-attribute

enableBeginFrameControl

newWindow instance-attribute

newWindow

background instance-attribute

background

forTab instance-attribute

forTab

hidden instance-attribute

hidden

DetachFromTargetParams

Bases: TypedDict

Parameters for the detachFromTarget command.

sessionId instance-attribute

sessionId

targetId instance-attribute

targetId

DisposeBrowserContextParams

Bases: TypedDict

Parameters for the disposeBrowserContext command.

browserContextId instance-attribute

browserContextId

GetTargetInfoParams

Bases: TypedDict

Parameters for the getTargetInfo command.

targetId instance-attribute

targetId

GetTargetsParams

Bases: TypedDict

Parameters for the getTargets command.

filter instance-attribute

filter

SendMessageToTargetParams

Bases: TypedDict

Parameters for the sendMessageToTarget command.

message instance-attribute

message

sessionId instance-attribute

sessionId

targetId instance-attribute

targetId

SetAutoAttachParams

Bases: TypedDict

Parameters for the setAutoAttach command.

autoAttach instance-attribute

autoAttach

waitForDebuggerOnStart instance-attribute

waitForDebuggerOnStart

flatten instance-attribute

flatten

filter instance-attribute

filter

AutoAttachRelatedParams

Bases: TypedDict

Parameters for the autoAttachRelated command.

targetId instance-attribute

targetId

waitForDebuggerOnStart instance-attribute

waitForDebuggerOnStart

filter instance-attribute

filter

SetDiscoverTargetsParams

Bases: TypedDict

Parameters for the setDiscoverTargets command.

discover instance-attribute

discover

filter instance-attribute

filter

SetRemoteLocationsParams

Bases: TypedDict

Parameters for the setRemoteLocations command.

locations instance-attribute

locations

OpenDevToolsParams

Bases: TypedDict

Parameters for the openDevTools command.

targetId instance-attribute

targetId

AttachToTargetResult

Bases: TypedDict

Result for the attachToTarget command.

sessionId instance-attribute

sessionId

AttachToBrowserTargetResult

Bases: TypedDict

Result for the attachToBrowserTarget command.

sessionId instance-attribute

sessionId

CloseTargetResult

Bases: TypedDict

Result for the closeTarget command.

success instance-attribute

success

CreateBrowserContextResult

Bases: TypedDict

Result for the createBrowserContext command.

browserContextId instance-attribute

browserContextId

GetBrowserContextsResult

Bases: TypedDict

Result for the getBrowserContexts command.

browserContextIds instance-attribute

browserContextIds

CreateTargetResult

Bases: TypedDict

Result for the createTarget command.

targetId instance-attribute

targetId

GetTargetInfoResult

Bases: TypedDict

Result for the getTargetInfo command.

targetInfo instance-attribute

targetInfo

GetTargetsResult

Bases: TypedDict

Result for the getTargets command.

targetInfos instance-attribute

targetInfos

OpenDevToolsResult

Bases: TypedDict

Result for the openDevTools command.

targetId instance-attribute

targetId

事件

pydoll.protocol.target.events

AttachedToTargetEvent module-attribute

AttachedToTargetEvent = CDPEvent[AttachedToTargetParams]

DetachedFromTargetEvent module-attribute

DetachedFromTargetEvent = CDPEvent[DetachedFromTargetParams]

ReceivedMessageFromTargetEvent module-attribute

ReceivedMessageFromTargetEvent = CDPEvent[ReceivedMessageFromTargetParams]

TargetCreatedEvent module-attribute

TargetCreatedEvent = CDPEvent[TargetCreatedParams]

TargetDestroyedEvent module-attribute

TargetDestroyedEvent = CDPEvent[TargetDestroyedParams]

TargetCrashedEvent module-attribute

TargetCrashedEvent = CDPEvent[TargetCrashedParams]

TargetInfoChangedEvent module-attribute

TargetInfoChangedEvent = CDPEvent[TargetInfoChangedParams]

TargetEvent

Bases: str, Enum

Events from the Target domain of the Chrome DevTools Protocol.

This enumeration contains the names of Target-related events that can be received from the Chrome DevTools Protocol. These events provide information about target creation, destruction, and communication between targets.

RECEIVED_MESSAGE_FROM_TARGET class-attribute instance-attribute

RECEIVED_MESSAGE_FROM_TARGET = 'Target.receivedMessageFromTarget'

Notifies about a new protocol message received from the session (as reported in attachedToTarget event).

PARAMETER DESCRIPTION
sessionId

Identifier of a session which sends a message.

TYPE: SessionID

message

The message content.

TYPE: str

targetId

Deprecated.

TYPE: TargetID

TARGET_CRASHED class-attribute instance-attribute

TARGET_CRASHED = 'Target.targetCrashed'

Issued when a target has crashed.

PARAMETER DESCRIPTION
targetId

Identifier of the crashed target.

TYPE: TargetID

status

Termination status type.

TYPE: str

errorCode

Termination error code.

TYPE: int

TARGET_CREATED class-attribute instance-attribute

TARGET_CREATED = 'Target.targetCreated'

Issued when a possible inspection target is created.

PARAMETER DESCRIPTION
targetInfo

Information about the created target.

TYPE: TargetInfo

TARGET_DESTROYED class-attribute instance-attribute

TARGET_DESTROYED = 'Target.targetDestroyed'

Issued when a target is destroyed.

PARAMETER DESCRIPTION
targetId

Identifier of the destroyed target.

TYPE: TargetID

TARGET_INFO_CHANGED class-attribute instance-attribute

TARGET_INFO_CHANGED = 'Target.targetInfoChanged'

Issued when some information about a target has changed. This only happens between targetCreated and targetDestroyed.

PARAMETER DESCRIPTION
targetInfo

Updated information about the target.

TYPE: TargetInfo

ATTACHED_TO_TARGET class-attribute instance-attribute

ATTACHED_TO_TARGET = 'Target.attachedToTarget'

Issued when attached to target because of auto-attach or attachToTarget command.

PARAMETER DESCRIPTION
sessionId

Identifier assigned to the session used to send/receive messages.

TYPE: SessionID

targetInfo

Information about the target.

TYPE: TargetInfo

waitingForDebugger

Whether the target is waiting for debugger to attach.

TYPE: bool

DETACHED_FROM_TARGET class-attribute instance-attribute

DETACHED_FROM_TARGET = 'Target.detachedFromTarget'

Issued when detached from target for any reason (including detachFromTarget command). Can be issued multiple times per target if multiple sessions have been attached to it.

PARAMETER DESCRIPTION
sessionId

Detached session identifier.

TYPE: SessionID

targetId

Deprecated.

TYPE: TargetID

AttachedToTargetParams

Bases: TypedDict

Parameters for the attachedToTarget event.

sessionId instance-attribute

sessionId

targetInfo instance-attribute

targetInfo

waitingForDebugger instance-attribute

waitingForDebugger

DetachedFromTargetParams

Bases: TypedDict

Parameters for the detachedFromTarget event.

sessionId instance-attribute

sessionId

targetId instance-attribute

targetId

ReceivedMessageFromTargetParams

Bases: TypedDict

Parameters for the receivedMessageFromTarget event.

sessionId instance-attribute

sessionId

message instance-attribute

message

targetId instance-attribute

targetId

TargetCreatedParams

Bases: TypedDict

Parameters for the targetCreated event.

targetInfo instance-attribute

targetInfo

TargetDestroyedParams

Bases: TypedDict

Parameters for the targetDestroyed event.

targetId instance-attribute

targetId

TargetCrashedParams

Bases: TypedDict

Parameters for the targetCrashed event.

targetId instance-attribute

targetId

status instance-attribute

status

errorCode instance-attribute

errorCode

TargetInfoChangedParams

Bases: TypedDict

Parameters for the targetInfoChanged event.

targetInfo instance-attribute

targetInfo

类型

pydoll.protocol.target.types

TargetID module-attribute

TargetID = str

SessionID module-attribute

SessionID = str

TargetFilter module-attribute

TargetFilter = list[FilterEntry]

TargetInfo

Bases: TypedDict

targetId instance-attribute

targetId

type instance-attribute

type

title instance-attribute

title

url instance-attribute

url

attached instance-attribute

attached

openerId instance-attribute

openerId

canAccessOpener instance-attribute

canAccessOpener

openerFrameId instance-attribute

openerFrameId

browserContextId instance-attribute

browserContextId

subtype instance-attribute

subtype

FilterEntry

Bases: TypedDict

A filter used by target query/discovery/auto-attach operations.

exclude instance-attribute

exclude

type instance-attribute

type

RemoteLocation

Bases: TypedDict

host instance-attribute

host

port instance-attribute

port