target

package
Version: v0.32.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2021 License: MIT Imports: 4 Imported by: 50

Documentation

Overview

Package target implements the Target domain. Supports additional targets discovery and allows to attach to them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(conn *rpcc.Conn) *domainClient

NewClient returns a client for the Target domain with the connection set to conn.

Types

type ActivateTargetArgs

type ActivateTargetArgs struct {
	TargetID ID `json:"targetId"` // No description.
}

ActivateTargetArgs represents the arguments for ActivateTarget in the Target domain.

func NewActivateTargetArgs

func NewActivateTargetArgs(targetID ID) *ActivateTargetArgs

NewActivateTargetArgs initializes ActivateTargetArgs with the required arguments.

type AttachToBrowserTargetReply added in v0.18.6

type AttachToBrowserTargetReply struct {
	SessionID SessionID `json:"sessionId"` // Id assigned to the session.
}

AttachToBrowserTargetReply represents the return values for AttachToBrowserTarget in the Target domain.

type AttachToTargetArgs

type AttachToTargetArgs struct {
	TargetID ID    `json:"targetId"`          // No description.
	Flatten  *bool `json:"flatten,omitempty"` // 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.
}

AttachToTargetArgs represents the arguments for AttachToTarget in the Target domain.

func NewAttachToTargetArgs

func NewAttachToTargetArgs(targetID ID) *AttachToTargetArgs

NewAttachToTargetArgs initializes AttachToTargetArgs with the required arguments.

func (*AttachToTargetArgs) SetFlatten added in v0.18.5

func (a *AttachToTargetArgs) SetFlatten(flatten bool) *AttachToTargetArgs

SetFlatten sets the Flatten optional argument. 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 AttachToTargetReply

type AttachToTargetReply struct {
	SessionID SessionID `json:"sessionId"` // Id assigned to the session.
}

AttachToTargetReply represents the return values for AttachToTarget in the Target domain.

type AttachedToTargetClient

type AttachedToTargetClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*AttachedToTargetReply, error)
	rpcc.Stream
}

AttachedToTargetClient is a client for AttachedToTarget events. Issued when attached to target because of auto-attach or `attachToTarget` command.

type AttachedToTargetReply

type AttachedToTargetReply struct {
	SessionID          SessionID `json:"sessionId"`          // Identifier assigned to the session used to send/receive messages.
	TargetInfo         Info      `json:"targetInfo"`         // No description.
	WaitingForDebugger bool      `json:"waitingForDebugger"` // No description.
}

AttachedToTargetReply is the reply for AttachedToTarget events.

type CloseTargetArgs

type CloseTargetArgs struct {
	TargetID ID `json:"targetId"` // No description.
}

CloseTargetArgs represents the arguments for CloseTarget in the Target domain.

func NewCloseTargetArgs

func NewCloseTargetArgs(targetID ID) *CloseTargetArgs

NewCloseTargetArgs initializes CloseTargetArgs with the required arguments.

type CloseTargetReply

type CloseTargetReply struct {
	// Success is deprecated.
	//
	// Deprecated: Always set to true. If an error occurs, the response
	// indicates protocol error.
	Success bool `json:"success"`
}

CloseTargetReply represents the return values for CloseTarget in the Target domain.

type CrashedClient added in v0.18.4

type CrashedClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*CrashedReply, error)
	rpcc.Stream
}

CrashedClient is a client for TargetCrashed events. Issued when a target has crashed.

type CrashedReply added in v0.18.4

type CrashedReply struct {
	TargetID  ID     `json:"targetId"`  // No description.
	Status    string `json:"status"`    // Termination status type.
	ErrorCode int    `json:"errorCode"` // Termination error code.
}

CrashedReply is the reply for TargetCrashed events.

type CreateBrowserContextArgs added in v0.26.0

type CreateBrowserContextArgs struct {
	DisposeOnDetach *bool   `json:"disposeOnDetach,omitempty"` // If specified, disposes this context when debugging session disconnects.
	ProxyServer     *string `json:"proxyServer,omitempty"`     // Proxy server, similar to the one passed to --proxy-server
	ProxyBypassList *string `json:"proxyBypassList,omitempty"` // Proxy bypass list, similar to the one passed to --proxy-bypass-list
}

CreateBrowserContextArgs represents the arguments for CreateBrowserContext in the Target domain.

func NewCreateBrowserContextArgs added in v0.26.0

func NewCreateBrowserContextArgs() *CreateBrowserContextArgs

NewCreateBrowserContextArgs initializes CreateBrowserContextArgs with the required arguments.

func (*CreateBrowserContextArgs) SetDisposeOnDetach added in v0.26.0

func (a *CreateBrowserContextArgs) SetDisposeOnDetach(disposeOnDetach bool) *CreateBrowserContextArgs

SetDisposeOnDetach sets the DisposeOnDetach optional argument. If specified, disposes this context when debugging session disconnects.

func (*CreateBrowserContextArgs) SetProxyBypassList added in v0.31.0

func (a *CreateBrowserContextArgs) SetProxyBypassList(proxyBypassList string) *CreateBrowserContextArgs

SetProxyBypassList sets the ProxyBypassList optional argument. Proxy bypass list, similar to the one passed to --proxy-bypass-list

func (*CreateBrowserContextArgs) SetProxyServer added in v0.31.0

func (a *CreateBrowserContextArgs) SetProxyServer(proxyServer string) *CreateBrowserContextArgs

SetProxyServer sets the ProxyServer optional argument. Proxy server, similar to the one passed to --proxy-server

type CreateBrowserContextReply

type CreateBrowserContextReply struct {
	BrowserContextID internal.BrowserContextID `json:"browserContextId"` // The id of the context created.
}

CreateBrowserContextReply represents the return values for CreateBrowserContext in the Target domain.

type CreateTargetArgs

type CreateTargetArgs struct {
	URL              string                     `json:"url"`                        // The initial URL the page will be navigated to. An empty string indicates about:blank.
	Width            *int                       `json:"width,omitempty"`            // Frame width in DIP (headless chrome only).
	Height           *int                       `json:"height,omitempty"`           // Frame height in DIP (headless chrome only).
	BrowserContextID *internal.BrowserContextID `json:"browserContextId,omitempty"` // The browser context to create the page in.
	// EnableBeginFrameControl Whether BeginFrames for this target will be
	// controlled via DevTools (headless chrome only, not supported on
	// MacOS yet, false by default).
	//
	// Note: This property is experimental.
	EnableBeginFrameControl *bool `json:"enableBeginFrameControl,omitempty"`
	NewWindow               *bool `json:"newWindow,omitempty"`  // Whether to create a new Window or Tab (chrome-only, false by default).
	Background              *bool `json:"background,omitempty"` // Whether to create the target in background or foreground (chrome-only, false by default).
}

CreateTargetArgs represents the arguments for CreateTarget in the Target domain.

func NewCreateTargetArgs

func NewCreateTargetArgs(url string) *CreateTargetArgs

NewCreateTargetArgs initializes CreateTargetArgs with the required arguments.

func (*CreateTargetArgs) SetBackground added in v0.23.3

func (a *CreateTargetArgs) SetBackground(background bool) *CreateTargetArgs

SetBackground sets the Background optional argument. Whether to create the target in background or foreground (chrome-only, false by default).

func (*CreateTargetArgs) SetBrowserContextID

func (a *CreateTargetArgs) SetBrowserContextID(browserContextID internal.BrowserContextID) *CreateTargetArgs

SetBrowserContextID sets the BrowserContextID optional argument. The browser context to create the page in.

func (*CreateTargetArgs) SetEnableBeginFrameControl added in v0.14.1

func (a *CreateTargetArgs) SetEnableBeginFrameControl(enableBeginFrameControl bool) *CreateTargetArgs

SetEnableBeginFrameControl sets the EnableBeginFrameControl optional argument. Whether BeginFrames for this target will be controlled via DevTools (headless chrome only, not supported on MacOS yet, false by default).

Note: This property is experimental.

func (*CreateTargetArgs) SetHeight

func (a *CreateTargetArgs) SetHeight(height int) *CreateTargetArgs

SetHeight sets the Height optional argument. Frame height in DIP (headless chrome only).

func (*CreateTargetArgs) SetNewWindow added in v0.23.3

func (a *CreateTargetArgs) SetNewWindow(newWindow bool) *CreateTargetArgs

SetNewWindow sets the NewWindow optional argument. Whether to create a new Window or Tab (chrome-only, false by default).

func (*CreateTargetArgs) SetWidth

func (a *CreateTargetArgs) SetWidth(width int) *CreateTargetArgs

SetWidth sets the Width optional argument. Frame width in DIP (headless chrome only).

type CreateTargetReply

type CreateTargetReply struct {
	TargetID ID `json:"targetId"` // The id of the page opened.
}

CreateTargetReply represents the return values for CreateTarget in the Target domain.

type CreatedClient

type CreatedClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*CreatedReply, error)
	rpcc.Stream
}

CreatedClient is a client for TargetCreated events. Issued when a possible inspection target is created.

type CreatedReply

type CreatedReply struct {
	TargetInfo Info `json:"targetInfo"` // No description.
}

CreatedReply is the reply for TargetCreated events.

type DestroyedClient

type DestroyedClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*DestroyedReply, error)
	rpcc.Stream
}

DestroyedClient is a client for TargetDestroyed events. Issued when a target is destroyed.

type DestroyedReply

type DestroyedReply struct {
	TargetID ID `json:"targetId"` // No description.
}

DestroyedReply is the reply for TargetDestroyed events.

type DetachFromTargetArgs

type DetachFromTargetArgs struct {
	SessionID *SessionID `json:"sessionId,omitempty"` // Session to detach.
	// TargetID is deprecated.
	//
	// Deprecated: Deprecated.
	TargetID *ID `json:"targetId,omitempty"`
}

DetachFromTargetArgs represents the arguments for DetachFromTarget in the Target domain.

func NewDetachFromTargetArgs

func NewDetachFromTargetArgs() *DetachFromTargetArgs

NewDetachFromTargetArgs initializes DetachFromTargetArgs with the required arguments.

func (*DetachFromTargetArgs) SetSessionID added in v0.9.1

func (a *DetachFromTargetArgs) SetSessionID(sessionID SessionID) *DetachFromTargetArgs

SetSessionID sets the SessionID optional argument. Session to detach.

func (*DetachFromTargetArgs) SetTargetID deprecated added in v0.9.1

func (a *DetachFromTargetArgs) SetTargetID(targetID ID) *DetachFromTargetArgs

SetTargetID sets the TargetID optional argument.

Deprecated: Deprecated.

type DetachedFromTargetClient

type DetachedFromTargetClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*DetachedFromTargetReply, error)
	rpcc.Stream
}

DetachedFromTargetClient is a client for DetachedFromTarget events. 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.

type DetachedFromTargetReply

type DetachedFromTargetReply struct {
	SessionID SessionID `json:"sessionId"` // Detached session identifier.
	// TargetID is deprecated.
	//
	// Deprecated: Deprecated.
	TargetID *ID `json:"targetId,omitempty"`
}

DetachedFromTargetReply is the reply for DetachedFromTarget events.

type DisposeBrowserContextArgs

type DisposeBrowserContextArgs struct {
	BrowserContextID internal.BrowserContextID `json:"browserContextId"` // No description.
}

DisposeBrowserContextArgs represents the arguments for DisposeBrowserContext in the Target domain.

func NewDisposeBrowserContextArgs

func NewDisposeBrowserContextArgs(browserContextID internal.BrowserContextID) *DisposeBrowserContextArgs

NewDisposeBrowserContextArgs initializes DisposeBrowserContextArgs with the required arguments.

type ExposeDevToolsProtocolArgs added in v0.18.4

type ExposeDevToolsProtocolArgs struct {
	TargetID    ID      `json:"targetId"`              // No description.
	BindingName *string `json:"bindingName,omitempty"` // Binding name, 'cdp' if not specified.
}

ExposeDevToolsProtocolArgs represents the arguments for ExposeDevToolsProtocol in the Target domain.

func NewExposeDevToolsProtocolArgs added in v0.18.4

func NewExposeDevToolsProtocolArgs(targetID ID) *ExposeDevToolsProtocolArgs

NewExposeDevToolsProtocolArgs initializes ExposeDevToolsProtocolArgs with the required arguments.

func (*ExposeDevToolsProtocolArgs) SetBindingName added in v0.18.4

func (a *ExposeDevToolsProtocolArgs) SetBindingName(bindingName string) *ExposeDevToolsProtocolArgs

SetBindingName sets the BindingName optional argument. Binding name, 'cdp' if not specified.

type GetBrowserContextsReply added in v0.18.2

type GetBrowserContextsReply struct {
	BrowserContextIDs []internal.BrowserContextID `json:"browserContextIds"` // An array of browser context ids.
}

GetBrowserContextsReply represents the return values for GetBrowserContexts in the Target domain.

type GetTargetInfoArgs

type GetTargetInfoArgs struct {
	TargetID *ID `json:"targetId,omitempty"` // No description.
}

GetTargetInfoArgs represents the arguments for GetTargetInfo in the Target domain.

func NewGetTargetInfoArgs

func NewGetTargetInfoArgs() *GetTargetInfoArgs

NewGetTargetInfoArgs initializes GetTargetInfoArgs with the required arguments.

func (*GetTargetInfoArgs) SetTargetID added in v0.18.5

func (a *GetTargetInfoArgs) SetTargetID(targetID ID) *GetTargetInfoArgs

SetTargetID sets the TargetID optional argument.

type GetTargetInfoReply

type GetTargetInfoReply struct {
	TargetInfo Info `json:"targetInfo"` // No description.
}

GetTargetInfoReply represents the return values for GetTargetInfo in the Target domain.

type GetTargetsReply

type GetTargetsReply struct {
	TargetInfos []Info `json:"targetInfos"` // The list of targets.
}

GetTargetsReply represents the return values for GetTargets in the Target domain.

type ID

type ID string

ID

type Info

type Info struct {
	TargetID ID     `json:"targetId"`           // No description.
	Type     string `json:"type"`               // No description.
	Title    string `json:"title"`              // No description.
	URL      string `json:"url"`                // No description.
	Attached bool   `json:"attached"`           // Whether the target has an attached client.
	OpenerID *ID    `json:"openerId,omitempty"` // Opener target Id
	// CanAccessOpener Whether the target has access to the originating
	// window.
	//
	// Note: This property is experimental.
	CanAccessOpener bool `json:"canAccessOpener"`
	// OpenerFrameID Frame id of originating window (is only set if target
	// has an opener).
	//
	// Note: This property is experimental.
	OpenerFrameID *page.FrameID `json:"openerFrameId,omitempty"`
	// BrowserContextID
	//
	// Note: This property is experimental.
	BrowserContextID *internal.BrowserContextID `json:"browserContextId,omitempty"`
}

Info

type InfoChangedClient

type InfoChangedClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*InfoChangedReply, error)
	rpcc.Stream
}

InfoChangedClient is a client for TargetInfoChanged events. Issued when some information about a target has changed. This only happens between `targetCreated` and `targetDestroyed`.

type InfoChangedReply

type InfoChangedReply struct {
	TargetInfo Info `json:"targetInfo"` // No description.
}

InfoChangedReply is the reply for TargetInfoChanged events.

type ReceivedMessageFromTargetClient

type ReceivedMessageFromTargetClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*ReceivedMessageFromTargetReply, error)
	rpcc.Stream
}

ReceivedMessageFromTargetClient is a client for ReceivedMessageFromTarget events. Notifies about a new protocol message received from the session (as reported in `attachedToTarget` event).

type ReceivedMessageFromTargetReply

type ReceivedMessageFromTargetReply struct {
	SessionID SessionID `json:"sessionId"` // Identifier of a session which sends a message.
	Message   string    `json:"message"`   // No description.
	// TargetID is deprecated.
	//
	// Deprecated: Deprecated.
	TargetID *ID `json:"targetId,omitempty"`
}

ReceivedMessageFromTargetReply is the reply for ReceivedMessageFromTarget events.

type RemoteLocation

type RemoteLocation struct {
	Host string `json:"host"` // No description.
	Port int    `json:"port"` // No description.
}

RemoteLocation

Note: This type is experimental.

type SendMessageToTargetArgs

type SendMessageToTargetArgs struct {
	Message   string     `json:"message"`             // No description.
	SessionID *SessionID `json:"sessionId,omitempty"` // Identifier of the session.
	// TargetID is deprecated.
	//
	// Deprecated: Deprecated.
	TargetID *ID `json:"targetId,omitempty"`
}

SendMessageToTargetArgs represents the arguments for SendMessageToTarget in the Target domain.

func NewSendMessageToTargetArgs

func NewSendMessageToTargetArgs(message string) *SendMessageToTargetArgs

NewSendMessageToTargetArgs initializes SendMessageToTargetArgs with the required arguments.

func (*SendMessageToTargetArgs) SetSessionID added in v0.9.1

func (a *SendMessageToTargetArgs) SetSessionID(sessionID SessionID) *SendMessageToTargetArgs

SetSessionID sets the SessionID optional argument. Identifier of the session.

func (*SendMessageToTargetArgs) SetTargetID deprecated added in v0.9.1

func (a *SendMessageToTargetArgs) SetTargetID(targetID ID) *SendMessageToTargetArgs

SetTargetID sets the TargetID optional argument.

Deprecated: Deprecated.

type SessionID added in v0.9.1

type SessionID string

SessionID Unique identifier of attached debugging session.

type SetAutoAttachArgs

type SetAutoAttachArgs 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"`      // 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.
}

SetAutoAttachArgs represents the arguments for SetAutoAttach in the Target domain.

func NewSetAutoAttachArgs

func NewSetAutoAttachArgs(autoAttach bool, waitForDebuggerOnStart bool) *SetAutoAttachArgs

NewSetAutoAttachArgs initializes SetAutoAttachArgs with the required arguments.

func (*SetAutoAttachArgs) SetFlatten added in v0.18.6

func (a *SetAutoAttachArgs) SetFlatten(flatten bool) *SetAutoAttachArgs

SetFlatten sets the Flatten optional argument. 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 SetDiscoverTargetsArgs

type SetDiscoverTargetsArgs struct {
	Discover bool `json:"discover"` // Whether to discover available targets.
}

SetDiscoverTargetsArgs represents the arguments for SetDiscoverTargets in the Target domain.

func NewSetDiscoverTargetsArgs

func NewSetDiscoverTargetsArgs(discover bool) *SetDiscoverTargetsArgs

NewSetDiscoverTargetsArgs initializes SetDiscoverTargetsArgs with the required arguments.

type SetRemoteLocationsArgs

type SetRemoteLocationsArgs struct {
	Locations []RemoteLocation `json:"locations"` // List of remote locations.
}

SetRemoteLocationsArgs represents the arguments for SetRemoteLocations in the Target domain.

func NewSetRemoteLocationsArgs

func NewSetRemoteLocationsArgs(locations []RemoteLocation) *SetRemoteLocationsArgs

NewSetRemoteLocationsArgs initializes SetRemoteLocationsArgs with the required arguments.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL