Target Domain
Supports additional targets discovery and allows to attach to them.
Methods
Events
Types
Methods
Target.attachToTarget #
Attaches to the target with given id.
parameters
- targetId
-
TargetID
- flatten
-
boolean
Enables "flat" access to the session via specifying sessionId attribute in the commands. We plan to make this the default, deprecate non-flattened mode, and eventually retire it. See crbug.com/991325.
Return Object
- sessionId
-
SessionID
Id assigned to the session.
Target.closeTarget #
Closes the target. If the target is a page that gets closed too.
parameters
- targetId
-
TargetID
Return Object
- success
-
boolean
Always set to true. If an error occurs, the response indicates protocol error.
Target.createTarget #
Creates a new page.
parameters
- url
-
string
The initial URL the page will be navigated to. An empty string indicates about:blank.
- width
-
integer
Frame width in DIP (headless chrome only).
- height
-
integer
Frame height in DIP (headless chrome only).
- browserContextId
-
Browser.BrowserContextID
The browser context to create the page in.
- enableBeginFrameControl
-
boolean
Whether BeginFrames for this target will be controlled via DevTools (headless chrome only, not supported on MacOS yet, false by default).
- newWindow
-
boolean
Whether to create a new Window or Tab (chrome-only, false by default).
- background
-
boolean
Whether to create the target in background or foreground (chrome-only, false by default).
- forTab
-
boolean
Whether to create the target of type "tab".
Return Object
- targetId
-
TargetID
The id of the page opened.
Target.getTargets #
Retrieves a list of available targets.
parameters
- filter
-
TargetFilter
Only targets matching filter will be reported. If filter is not specified and target discovery is currently enabled, a filter used for target discovery is used for consistency.
Return Object
- targetInfos
-
array[ TargetInfo ]
The list of targets.
Target.setDiscoverTargets #
Controls whether to discover available targets and notify via
targetCreated/targetInfoChanged/targetDestroyed
events.
parameters
- discover
-
boolean
Whether to discover available targets.
- filter
-
TargetFilter
Only targets matching filter will be attached. If
discover
is false,filter
must be omitted or empty.
Events
Target.receivedMessageFromTarget #
Notifies about a new protocol message received from the session (as reported in
attachedToTarget
event).
parameters
Target.targetCrashed #
Issued when a target has crashed.
parameters
- targetId
-
TargetID
- status
-
string
Termination status type.
- errorCode
-
integer
Termination error code.
Target.targetCreated #
Issued when a possible inspection target is created.
parameters
- targetInfo
-
TargetInfo
Target.targetInfoChanged #
Issued when some information about a target has changed. This only happens between
targetCreated
and targetDestroyed
.
parameters
- targetInfo
-
TargetInfo
Types
Target.TargetInfo #
Type: object
properties
- targetId
-
TargetID
- type
-
string
- title
-
string
- url
-
string
- attached
-
boolean
Whether the target has an attached client.
- openerId
-
TargetID
Opener target Id
- canAccessOpener
-
boolean
Whether the target has access to the originating window.
- openerFrameId
-
Page.FrameId
Frame id of originating window (is only set if target has an opener).
- browserContextId
-
Browser.BrowserContextID
- subtype
-
string
Provides additional details for specific target types. For example, for the type of "page", this may be set to "portal" or "prerender".