Documentation
¶
Overview ¶
Package target provides the Chrome DevTools Protocol commands, types, and events for the Target domain.
Supports additional targets discovery and allows to attach to them.
Generated by the cdproto-gen command.
Index ¶
- Constants
- type ActivateTargetParams
- type AttachToBrowserTargetParams
- type AttachToBrowserTargetReturns
- type AttachToTargetParams
- type AttachToTargetReturns
- type AutoAttachRelatedParams
- type CloseTargetParams
- type CreateBrowserContextParams
- func (p *CreateBrowserContextParams) Do(ctx context.Context) (browserContextID cdp.BrowserContextID, err error)
- func (p CreateBrowserContextParams) WithDisposeOnDetach(disposeOnDetach bool) *CreateBrowserContextParams
- func (p CreateBrowserContextParams) WithOriginsWithUniversalNetworkAccess(originsWithUniversalNetworkAccess []string) *CreateBrowserContextParams
- func (p CreateBrowserContextParams) WithProxyBypassList(proxyBypassList string) *CreateBrowserContextParams
- func (p CreateBrowserContextParams) WithProxyServer(proxyServer string) *CreateBrowserContextParams
- type CreateBrowserContextReturns
- type CreateTargetParams
- func (p *CreateTargetParams) Do(ctx context.Context) (targetID ID, err error)
- func (p CreateTargetParams) WithBackground(background bool) *CreateTargetParams
- func (p CreateTargetParams) WithBrowserContextID(browserContextID cdp.BrowserContextID) *CreateTargetParams
- func (p CreateTargetParams) WithEnableBeginFrameControl(enableBeginFrameControl bool) *CreateTargetParams
- func (p CreateTargetParams) WithForTab(forTab bool) *CreateTargetParams
- func (p CreateTargetParams) WithHeight(height int64) *CreateTargetParams
- func (p CreateTargetParams) WithLeft(left int64) *CreateTargetParams
- func (p CreateTargetParams) WithNewWindow(newWindow bool) *CreateTargetParams
- func (p CreateTargetParams) WithTop(top int64) *CreateTargetParams
- func (p CreateTargetParams) WithWidth(width int64) *CreateTargetParams
- func (p CreateTargetParams) WithWindowState(windowState WindowState) *CreateTargetParams
- type CreateTargetReturns
- type DetachFromTargetParams
- type DisposeBrowserContextParams
- type EventAttachedToTarget
- type EventDetachedFromTarget
- type EventReceivedMessageFromTarget
- type EventTargetCrashed
- type EventTargetCreated
- type EventTargetDestroyed
- type EventTargetInfoChanged
- type ExposeDevToolsProtocolParams
- type Filter
- type FilterEntry
- type GetBrowserContextsParams
- type GetBrowserContextsReturns
- type GetTargetInfoParams
- type GetTargetInfoReturns
- type GetTargetsParams
- type GetTargetsReturns
- type ID
- type Info
- type RemoteLocation
- type SessionID
- type SetAutoAttachParams
- type SetDiscoverTargetsParams
- type SetRemoteLocationsParams
- type WindowState
Constants ¶
const ( CommandActivateTarget = "Target.activateTarget" CommandAttachToTarget = "Target.attachToTarget" CommandAttachToBrowserTarget = "Target.attachToBrowserTarget" CommandCloseTarget = "Target.closeTarget" CommandExposeDevToolsProtocol = "Target.exposeDevToolsProtocol" CommandCreateBrowserContext = "Target.createBrowserContext" CommandGetBrowserContexts = "Target.getBrowserContexts" CommandCreateTarget = "Target.createTarget" CommandDetachFromTarget = "Target.detachFromTarget" CommandDisposeBrowserContext = "Target.disposeBrowserContext" CommandGetTargetInfo = "Target.getTargetInfo" CommandGetTargets = "Target.getTargets" CommandSetAutoAttach = "Target.setAutoAttach" CommandAutoAttachRelated = "Target.autoAttachRelated" CommandSetDiscoverTargets = "Target.setDiscoverTargets" CommandSetRemoteLocations = "Target.setRemoteLocations" )
Command names.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActivateTargetParams ¶
type ActivateTargetParams struct {
TargetID ID `json:"targetId"`
}
ActivateTargetParams activates (focuses) the target.
func ActivateTarget ¶
func ActivateTarget(targetID ID) *ActivateTargetParams
ActivateTarget activates (focuses) the target.
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#method-activateTarget
parameters:
targetID
type AttachToBrowserTargetParams ¶
type AttachToBrowserTargetParams struct{}
AttachToBrowserTargetParams attaches to the browser target, only uses flat sessionId mode.
func AttachToBrowserTarget ¶
func AttachToBrowserTarget() *AttachToBrowserTargetParams
AttachToBrowserTarget attaches to the browser target, only uses flat sessionId mode.
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#method-attachToBrowserTarget
type AttachToBrowserTargetReturns ¶
type AttachToBrowserTargetReturns struct {
SessionID SessionID `json:"sessionId,omitempty,omitzero"` // Id assigned to the session.
}
AttachToBrowserTargetReturns return values.
type AttachToTargetParams ¶
type AttachToTargetParams struct { TargetID ID `json:"targetId"` Flatten bool `json:"flatten,omitempty,omitzero"` // 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. }
AttachToTargetParams attaches to the target with given id.
func AttachToTarget ¶
func AttachToTarget(targetID ID) *AttachToTargetParams
AttachToTarget attaches to the target with given id.
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#method-attachToTarget
parameters:
targetID
func (*AttachToTargetParams) Do ¶
func (p *AttachToTargetParams) Do(ctx context.Context) (sessionID SessionID, err error)
Do executes Target.attachToTarget against the provided context.
returns:
sessionID - Id assigned to the session.
func (AttachToTargetParams) WithFlatten ¶
func (p AttachToTargetParams) WithFlatten(flatten bool) *AttachToTargetParams
WithFlatten 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.
type AttachToTargetReturns ¶
type AttachToTargetReturns struct {
SessionID SessionID `json:"sessionId,omitempty,omitzero"` // Id assigned to the session.
}
AttachToTargetReturns return values.
type AutoAttachRelatedParams ¶
type AutoAttachRelatedParams struct { TargetID ID `json:"targetId"` WaitForDebuggerOnStart bool `json:"waitForDebuggerOnStart"` // Whether to pause new targets when attaching to them. Use Runtime.runIfWaitingForDebugger to run paused targets. Filter Filter `json:"filter,omitempty,omitzero"` // Only targets matching filter will be attached. }
AutoAttachRelatedParams adds the specified target to the list of targets that will be monitored for any related target creation (such as child frames, child workers and new versions of service worker) and reported through attachedToTarget. The specified target is also auto-attached. This cancels the effect of any previous setAutoAttach and is also cancelled by subsequent setAutoAttach. Only available at the Browser target.
func AutoAttachRelated ¶
func AutoAttachRelated(targetID ID, waitForDebuggerOnStart bool) *AutoAttachRelatedParams
AutoAttachRelated adds the specified target to the list of targets that will be monitored for any related target creation (such as child frames, child workers and new versions of service worker) and reported through attachedToTarget. The specified target is also auto-attached. This cancels the effect of any previous setAutoAttach and is also cancelled by subsequent setAutoAttach. Only available at the Browser target.
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#method-autoAttachRelated
parameters:
targetID waitForDebuggerOnStart - Whether to pause new targets when attaching to them. Use Runtime.runIfWaitingForDebugger to run paused targets.
func (*AutoAttachRelatedParams) Do ¶
func (p *AutoAttachRelatedParams) Do(ctx context.Context) (err error)
Do executes Target.autoAttachRelated against the provided context.
func (AutoAttachRelatedParams) WithFilter ¶
func (p AutoAttachRelatedParams) WithFilter(filter Filter) *AutoAttachRelatedParams
WithFilter only targets matching filter will be attached.
type CloseTargetParams ¶
type CloseTargetParams struct {
TargetID ID `json:"targetId"`
}
CloseTargetParams closes the target. If the target is a page that gets closed too.
func CloseTarget ¶
func CloseTarget(targetID ID) *CloseTargetParams
CloseTarget closes the target. If the target is a page that gets closed too.
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#method-closeTarget
parameters:
targetID
type CreateBrowserContextParams ¶
type CreateBrowserContextParams struct { DisposeOnDetach bool `json:"disposeOnDetach,omitempty,omitzero"` // If specified, disposes this context when debugging session disconnects. ProxyServer string `json:"proxyServer,omitempty,omitzero"` // Proxy server, similar to the one passed to --proxy-server ProxyBypassList string `json:"proxyBypassList,omitempty,omitzero"` // Proxy bypass list, similar to the one passed to --proxy-bypass-list OriginsWithUniversalNetworkAccess []string `json:"originsWithUniversalNetworkAccess,omitempty,omitzero"` // An optional list of origins to grant unlimited cross-origin access to. Parts of the URL other than those constituting origin are ignored. }
CreateBrowserContextParams creates a new empty BrowserContext. Similar to an incognito profile but you can have more than one.
func CreateBrowserContext ¶
func CreateBrowserContext() *CreateBrowserContextParams
CreateBrowserContext creates a new empty BrowserContext. Similar to an incognito profile but you can have more than one.
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#method-createBrowserContext
parameters:
func (*CreateBrowserContextParams) Do ¶
func (p *CreateBrowserContextParams) Do(ctx context.Context) (browserContextID cdp.BrowserContextID, err error)
Do executes Target.createBrowserContext against the provided context.
returns:
browserContextID - The id of the context created.
func (CreateBrowserContextParams) WithDisposeOnDetach ¶
func (p CreateBrowserContextParams) WithDisposeOnDetach(disposeOnDetach bool) *CreateBrowserContextParams
WithDisposeOnDetach if specified, disposes this context when debugging session disconnects.
func (CreateBrowserContextParams) WithOriginsWithUniversalNetworkAccess ¶
func (p CreateBrowserContextParams) WithOriginsWithUniversalNetworkAccess(originsWithUniversalNetworkAccess []string) *CreateBrowserContextParams
WithOriginsWithUniversalNetworkAccess an optional list of origins to grant unlimited cross-origin access to. Parts of the URL other than those constituting origin are ignored.
func (CreateBrowserContextParams) WithProxyBypassList ¶
func (p CreateBrowserContextParams) WithProxyBypassList(proxyBypassList string) *CreateBrowserContextParams
WithProxyBypassList proxy bypass list, similar to the one passed to --proxy-bypass-list.
func (CreateBrowserContextParams) WithProxyServer ¶
func (p CreateBrowserContextParams) WithProxyServer(proxyServer string) *CreateBrowserContextParams
WithProxyServer proxy server, similar to the one passed to --proxy-server.
type CreateBrowserContextReturns ¶
type CreateBrowserContextReturns struct {
BrowserContextID cdp.BrowserContextID `json:"browserContextId,omitempty,omitzero"` // The id of the context created.
}
CreateBrowserContextReturns return values.
type CreateTargetParams ¶
type CreateTargetParams struct { URL string `json:"url"` // The initial URL the page will be navigated to. An empty string indicates about:blank. Left int64 `json:"left,omitempty,omitzero"` // Frame left origin in DIP (requires newWindow to be true or headless shell). Top int64 `json:"top,omitempty,omitzero"` // Frame top origin in DIP (requires newWindow to be true or headless shell). Width int64 `json:"width,omitempty,omitzero"` // Frame width in DIP (requires newWindow to be true or headless shell). Height int64 `json:"height,omitempty,omitzero"` // Frame height in DIP (requires newWindow to be true or headless shell). WindowState WindowState `json:"windowState,omitempty,omitzero"` // Frame window state (requires newWindow to be true or headless shell). Default is normal. BrowserContextID cdp.BrowserContextID `json:"browserContextId,omitempty,omitzero"` // The browser context to create the page in. EnableBeginFrameControl bool `json:"enableBeginFrameControl,omitempty,omitzero"` // Whether BeginFrames for this target will be controlled via DevTools (headless shell only, not supported on MacOS yet, false by default). NewWindow bool `json:"newWindow,omitempty,omitzero"` // Whether to create a new Window or Tab (false by default, not supported by headless shell). Background bool `json:"background,omitempty,omitzero"` // Whether to create the target in background or foreground (false by default, not supported by headless shell). ForTab bool `json:"forTab,omitempty,omitzero"` // Whether to create the target of type "tab". }
CreateTargetParams creates a new page.
func CreateTarget ¶
func CreateTarget(url string) *CreateTargetParams
CreateTarget creates a new page.
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#method-createTarget
parameters:
url - The initial URL the page will be navigated to. An empty string indicates about:blank.
func (*CreateTargetParams) Do ¶
func (p *CreateTargetParams) Do(ctx context.Context) (targetID ID, err error)
Do executes Target.createTarget against the provided context.
returns:
targetID - The id of the page opened.
func (CreateTargetParams) WithBackground ¶
func (p CreateTargetParams) WithBackground(background bool) *CreateTargetParams
WithBackground whether to create the target in background or foreground (false by default, not supported by headless shell).
func (CreateTargetParams) WithBrowserContextID ¶
func (p CreateTargetParams) WithBrowserContextID(browserContextID cdp.BrowserContextID) *CreateTargetParams
WithBrowserContextID the browser context to create the page in.
func (CreateTargetParams) WithEnableBeginFrameControl ¶
func (p CreateTargetParams) WithEnableBeginFrameControl(enableBeginFrameControl bool) *CreateTargetParams
WithEnableBeginFrameControl whether BeginFrames for this target will be controlled via DevTools (headless shell only, not supported on MacOS yet, false by default).
func (CreateTargetParams) WithForTab ¶
func (p CreateTargetParams) WithForTab(forTab bool) *CreateTargetParams
WithForTab whether to create the target of type "tab".
func (CreateTargetParams) WithHeight ¶
func (p CreateTargetParams) WithHeight(height int64) *CreateTargetParams
WithHeight frame height in DIP (requires newWindow to be true or headless shell).
func (CreateTargetParams) WithLeft ¶
func (p CreateTargetParams) WithLeft(left int64) *CreateTargetParams
WithLeft frame left origin in DIP (requires newWindow to be true or headless shell).
func (CreateTargetParams) WithNewWindow ¶
func (p CreateTargetParams) WithNewWindow(newWindow bool) *CreateTargetParams
WithNewWindow whether to create a new Window or Tab (false by default, not supported by headless shell).
func (CreateTargetParams) WithTop ¶
func (p CreateTargetParams) WithTop(top int64) *CreateTargetParams
WithTop frame top origin in DIP (requires newWindow to be true or headless shell).
func (CreateTargetParams) WithWidth ¶
func (p CreateTargetParams) WithWidth(width int64) *CreateTargetParams
WithWidth frame width in DIP (requires newWindow to be true or headless shell).
func (CreateTargetParams) WithWindowState ¶
func (p CreateTargetParams) WithWindowState(windowState WindowState) *CreateTargetParams
WithWindowState frame window state (requires newWindow to be true or headless shell). Default is normal.
type CreateTargetReturns ¶
type CreateTargetReturns struct {
TargetID ID `json:"targetId,omitempty,omitzero"` // The id of the page opened.
}
CreateTargetReturns return values.
type DetachFromTargetParams ¶
type DetachFromTargetParams struct {
SessionID SessionID `json:"sessionId,omitempty,omitzero"` // Session to detach.
}
DetachFromTargetParams detaches session with given id.
func DetachFromTarget ¶
func DetachFromTarget() *DetachFromTargetParams
DetachFromTarget detaches session with given id.
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#method-detachFromTarget
parameters:
func (*DetachFromTargetParams) Do ¶
func (p *DetachFromTargetParams) Do(ctx context.Context) (err error)
Do executes Target.detachFromTarget against the provided context.
func (DetachFromTargetParams) WithSessionID ¶
func (p DetachFromTargetParams) WithSessionID(sessionID SessionID) *DetachFromTargetParams
WithSessionID session to detach.
type DisposeBrowserContextParams ¶
type DisposeBrowserContextParams struct {
BrowserContextID cdp.BrowserContextID `json:"browserContextId"`
}
DisposeBrowserContextParams deletes a BrowserContext. All the belonging pages will be closed without calling their beforeunload hooks.
func DisposeBrowserContext ¶
func DisposeBrowserContext(browserContextID cdp.BrowserContextID) *DisposeBrowserContextParams
DisposeBrowserContext deletes a BrowserContext. All the belonging pages will be closed without calling their beforeunload hooks.
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#method-disposeBrowserContext
parameters:
browserContextID
type EventAttachedToTarget ¶
type EventAttachedToTarget struct { SessionID SessionID `json:"sessionId"` // Identifier assigned to the session used to send/receive messages. TargetInfo *Info `json:"targetInfo"` WaitingForDebugger bool `json:"waitingForDebugger"` }
EventAttachedToTarget issued when attached to target because of auto-attach or attachToTarget command.
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#event-attachedToTarget
type EventDetachedFromTarget ¶
type EventDetachedFromTarget struct {
SessionID SessionID `json:"sessionId"` // Detached session identifier.
}
EventDetachedFromTarget 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.
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#event-detachedFromTarget
type EventReceivedMessageFromTarget ¶
type EventReceivedMessageFromTarget struct { SessionID SessionID `json:"sessionId"` // Identifier of a session which sends a message. Message string `json:"message"` }
EventReceivedMessageFromTarget notifies about a new protocol message received from the session (as reported in attachedToTarget event).
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#event-receivedMessageFromTarget
type EventTargetCrashed ¶
type EventTargetCrashed struct { TargetID ID `json:"targetId"` Status string `json:"status"` // Termination status type. ErrorCode int64 `json:"errorCode"` // Termination error code. }
EventTargetCrashed issued when a target has crashed.
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#event-targetCrashed
type EventTargetCreated ¶
type EventTargetCreated struct {
TargetInfo *Info `json:"targetInfo"`
}
EventTargetCreated issued when a possible inspection target is created.
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#event-targetCreated
type EventTargetDestroyed ¶
type EventTargetDestroyed struct {
TargetID ID `json:"targetId"`
}
EventTargetDestroyed issued when a target is destroyed.
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#event-targetDestroyed
type EventTargetInfoChanged ¶
type EventTargetInfoChanged struct {
TargetInfo *Info `json:"targetInfo"`
}
EventTargetInfoChanged issued when some information about a target has changed. This only happens between targetCreated and targetDestroyed.
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#event-targetInfoChanged
type ExposeDevToolsProtocolParams ¶
type ExposeDevToolsProtocolParams struct { TargetID ID `json:"targetId"` BindingName string `json:"bindingName,omitempty,omitzero"` // Binding name, 'cdp' if not specified. InheritPermissions bool `json:"inheritPermissions,omitempty,omitzero"` // If true, inherits the current root session's permissions (default: false). }
ExposeDevToolsProtocolParams inject object to the target's main frame that provides a communication channel with browser target. Injected object will be available as window[bindingName]. The object has the following API: - binding.send(json) - a method to send messages over the remote debugging protocol - binding.onmessage = json => handleMessage(json) - a callback that will be called for the protocol notifications and command responses.
func ExposeDevToolsProtocol ¶
func ExposeDevToolsProtocol(targetID ID) *ExposeDevToolsProtocolParams
ExposeDevToolsProtocol inject object to the target's main frame that provides a communication channel with browser target. Injected object will be available as window[bindingName]. The object has the following API: - binding.send(json) - a method to send messages over the remote debugging protocol - binding.onmessage = json => handleMessage(json) - a callback that will be called for the protocol notifications and command responses.
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#method-exposeDevToolsProtocol
parameters:
targetID
func (*ExposeDevToolsProtocolParams) Do ¶
func (p *ExposeDevToolsProtocolParams) Do(ctx context.Context) (err error)
Do executes Target.exposeDevToolsProtocol against the provided context.
func (ExposeDevToolsProtocolParams) WithBindingName ¶
func (p ExposeDevToolsProtocolParams) WithBindingName(bindingName string) *ExposeDevToolsProtocolParams
WithBindingName binding name, 'cdp' if not specified.
func (ExposeDevToolsProtocolParams) WithInheritPermissions ¶
func (p ExposeDevToolsProtocolParams) WithInheritPermissions(inheritPermissions bool) *ExposeDevToolsProtocolParams
WithInheritPermissions if true, inherits the current root session's permissions (default: false).
type Filter ¶
type Filter []struct { Exclude bool `json:"exclude,omitempty,omitzero"` // If set, causes exclusion of matching targets from the list. Type string `json:"type,omitempty,omitzero"` // If not present, matches any type. }
Filter the entries in TargetFilter are matched sequentially against targets and the first entry that matches determines if the target is included or not, depending on the value of exclude field in the entry. If filter is not specified, the one assumed is [{type: "browser", exclude: true}, {type: "tab", exclude: true}, {}] (i.e. include everything but browser and tab).
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#type-TargetFilter
type FilterEntry ¶
type FilterEntry struct { Exclude bool `json:"exclude,omitempty,omitzero"` // If set, causes exclusion of matching targets from the list. Type string `json:"type,omitempty,omitzero"` // If not present, matches any type. }
FilterEntry a filter used by target query/discovery/auto-attach operations.
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#type-FilterEntry
type GetBrowserContextsParams ¶
type GetBrowserContextsParams struct{}
GetBrowserContextsParams returns all browser contexts created with Target.createBrowserContext method.
func GetBrowserContexts ¶
func GetBrowserContexts() *GetBrowserContextsParams
GetBrowserContexts returns all browser contexts created with Target.createBrowserContext method.
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#method-getBrowserContexts
func (*GetBrowserContextsParams) Do ¶
func (p *GetBrowserContextsParams) Do(ctx context.Context) (browserContextIDs []cdp.BrowserContextID, err error)
Do executes Target.getBrowserContexts against the provided context.
returns:
browserContextIDs - An array of browser context ids.
type GetBrowserContextsReturns ¶
type GetBrowserContextsReturns struct {
BrowserContextIDs []cdp.BrowserContextID `json:"browserContextIds,omitempty,omitzero"` // An array of browser context ids.
}
GetBrowserContextsReturns return values.
type GetTargetInfoParams ¶
type GetTargetInfoParams struct {
TargetID ID `json:"targetId,omitempty,omitzero"`
}
GetTargetInfoParams returns information about a target.
func GetTargetInfo ¶
func GetTargetInfo() *GetTargetInfoParams
GetTargetInfo returns information about a target.
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#method-getTargetInfo
parameters:
func (*GetTargetInfoParams) Do ¶
func (p *GetTargetInfoParams) Do(ctx context.Context) (targetInfo *Info, err error)
Do executes Target.getTargetInfo against the provided context.
returns:
targetInfo
func (GetTargetInfoParams) WithTargetID ¶
func (p GetTargetInfoParams) WithTargetID(targetID ID) *GetTargetInfoParams
WithTargetID [no description].
type GetTargetInfoReturns ¶
type GetTargetInfoReturns struct {
TargetInfo *Info `json:"targetInfo,omitempty,omitzero"`
}
GetTargetInfoReturns return values.
type GetTargetsParams ¶
type GetTargetsParams struct {
Filter Filter `json:"filter,omitempty,omitzero"` // 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.
}
GetTargetsParams retrieves a list of available targets.
func GetTargets ¶
func GetTargets() *GetTargetsParams
GetTargets retrieves a list of available targets.
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#method-getTargets
parameters:
func (*GetTargetsParams) Do ¶
func (p *GetTargetsParams) Do(ctx context.Context) (targetInfos []*Info, err error)
Do executes Target.getTargets against the provided context.
returns:
targetInfos - The list of targets.
func (GetTargetsParams) WithFilter ¶
func (p GetTargetsParams) WithFilter(filter Filter) *GetTargetsParams
WithFilter 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.
type GetTargetsReturns ¶
type GetTargetsReturns struct {
TargetInfos []*Info `json:"targetInfos,omitempty,omitzero"` // The list of targets.
}
GetTargetsReturns return values.
type ID ¶
type ID string
ID [no description].
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#type-TargetID
type Info ¶
type Info struct { TargetID ID `json:"targetId"` Type string `json:"type"` // List of types: https://source.chromium.org/chromium/chromium/src/+/main:content/browser/devtools/devtools_agent_host_impl.cc?ss=chromium&q=f:devtools%20-f:out%20%22::kTypeTab%5B%5D%22 Title string `json:"title"` URL string `json:"url"` Attached bool `json:"attached"` // Whether the target has an attached client. OpenerID ID `json:"openerId,omitempty,omitzero"` // Opener target Id CanAccessOpener bool `json:"canAccessOpener"` // Whether the target has access to the originating window. OpenerFrameID cdp.FrameID `json:"openerFrameId,omitempty,omitzero"` // Frame id of originating window (is only set if target has an opener). BrowserContextID cdp.BrowserContextID `json:"browserContextId,omitempty,omitzero"` Subtype string `json:"subtype,omitempty,omitzero"` // Provides additional details for specific target types. For example, for the type of "page", this may be set to "prerender". }
Info [no description].
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#type-TargetInfo
type RemoteLocation ¶
RemoteLocation [no description].
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#type-RemoteLocation
type SessionID ¶
type SessionID string
SessionID unique identifier of attached debugging session.
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#type-SessionID
type SetAutoAttachParams ¶
type SetAutoAttachParams struct { AutoAttach bool `json:"autoAttach"` // Whether to auto-attach to related targets. WaitForDebuggerOnStart bool `json:"waitForDebuggerOnStart"` // Whether to pause new targets when attaching to them. Use Runtime.runIfWaitingForDebugger to run paused targets. Flatten bool `json:"flatten,omitempty,omitzero"` // 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. Filter Filter `json:"filter,omitempty,omitzero"` // Only targets matching filter will be attached. }
SetAutoAttachParams controls whether to automatically attach to new targets which are considered to be related to this one. When turned on, attaches to all existing related targets as well. When turned off, automatically detaches from all currently attached targets. This also clears all targets added by autoAttachRelated from the list of targets to watch for creation of related targets.
func SetAutoAttach ¶
func SetAutoAttach(autoAttach bool, waitForDebuggerOnStart bool) *SetAutoAttachParams
SetAutoAttach controls whether to automatically attach to new targets which are considered to be related to this one. When turned on, attaches to all existing related targets as well. When turned off, automatically detaches from all currently attached targets. This also clears all targets added by autoAttachRelated from the list of targets to watch for creation of related targets.
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#method-setAutoAttach
parameters:
autoAttach - Whether to auto-attach to related targets. waitForDebuggerOnStart - Whether to pause new targets when attaching to them. Use Runtime.runIfWaitingForDebugger to run paused targets.
func (*SetAutoAttachParams) Do ¶
func (p *SetAutoAttachParams) Do(ctx context.Context) (err error)
Do executes Target.setAutoAttach against the provided context.
func (SetAutoAttachParams) WithFilter ¶
func (p SetAutoAttachParams) WithFilter(filter Filter) *SetAutoAttachParams
WithFilter only targets matching filter will be attached.
func (SetAutoAttachParams) WithFlatten ¶
func (p SetAutoAttachParams) WithFlatten(flatten bool) *SetAutoAttachParams
WithFlatten 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.
type SetDiscoverTargetsParams ¶
type SetDiscoverTargetsParams struct { Discover bool `json:"discover"` // Whether to discover available targets. Filter Filter `json:"filter,omitempty,omitzero"` // Only targets matching filter will be attached. If discover is false, filter must be omitted or empty. }
SetDiscoverTargetsParams controls whether to discover available targets and notify via targetCreated/targetInfoChanged/targetDestroyed events.
func SetDiscoverTargets ¶
func SetDiscoverTargets(discover bool) *SetDiscoverTargetsParams
SetDiscoverTargets controls whether to discover available targets and notify via targetCreated/targetInfoChanged/targetDestroyed events.
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#method-setDiscoverTargets
parameters:
discover - Whether to discover available targets.
func (*SetDiscoverTargetsParams) Do ¶
func (p *SetDiscoverTargetsParams) Do(ctx context.Context) (err error)
Do executes Target.setDiscoverTargets against the provided context.
func (SetDiscoverTargetsParams) WithFilter ¶
func (p SetDiscoverTargetsParams) WithFilter(filter Filter) *SetDiscoverTargetsParams
WithFilter only targets matching filter will be attached. If discover is false, filter must be omitted or empty.
type SetRemoteLocationsParams ¶
type SetRemoteLocationsParams struct {
Locations []*RemoteLocation `json:"locations"` // List of remote locations.
}
SetRemoteLocationsParams enables target discovery for the specified locations, when setDiscoverTargets was set to true.
func SetRemoteLocations ¶
func SetRemoteLocations(locations []*RemoteLocation) *SetRemoteLocationsParams
SetRemoteLocations enables target discovery for the specified locations, when setDiscoverTargets was set to true.
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#method-setRemoteLocations
parameters:
locations - List of remote locations.
type WindowState ¶
type WindowState string
WindowState the state of the target window.
See: https://chromedevtools.github.io/devtools-protocol/tot/Target#type-WindowState
const ( WindowStateNormal WindowState = "normal" WindowStateMinimized WindowState = "minimized" WindowStateMaximized WindowState = "maximized" WindowStateFullscreen WindowState = "fullscreen" )
WindowState values.
func (WindowState) String ¶
func (t WindowState) String() string
String returns the WindowState as string value.
func (*WindowState) UnmarshalJSON ¶
func (t *WindowState) UnmarshalJSON(buf []byte) error
UnmarshalJSON satisfies [json.Unmarshaler].