Documentation ¶
Overview ¶
Package client provides the low level Chrome Debugging Protocol JSON types and related funcs.
Index ¶
- Constants
- Variables
- type Chrome
- func (c *Chrome) GetID() string
- func (c *Chrome) GetType() TargetType
- func (c *Chrome) GetWebsocketURL() string
- func (v Chrome) MarshalEasyJSON(w *jwriter.Writer)
- func (v Chrome) MarshalJSON() ([]byte, error)
- func (c Chrome) String() string
- func (v *Chrome) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *Chrome) UnmarshalJSON(data []byte) error
- type Client
- func (c *Client) ActivateTarget(ctxt context.Context, t Target) error
- func (c *Client) CloseTarget(ctxt context.Context, t Target) error
- func (c *Client) ListPageTargets(ctxt context.Context) ([]Target, error)
- func (c *Client) ListTargets(ctxt context.Context) ([]Target, error)
- func (c *Client) ListTargetsWithType(ctxt context.Context, typ TargetType) ([]Target, error)
- func (c *Client) NewPageTarget(ctxt context.Context) (Target, error)
- func (c *Client) NewPageTargetWithURL(ctxt context.Context, urlstr string) (Target, error)
- func (c *Client) VersionInfo(ctxt context.Context) (map[string]string, error)
- func (c *Client) WatchPageTargets(ctxt context.Context) <-chan Target
- type Conn
- type DialOption
- type Option
- type Target
- type TargetType
- type Transport
Constants ¶
const ( // DefaultURL is the default Chrome URL to connect to. DefaultURL = "http://localhost:9222/json" // DefaultWatchInterval is the default check duration. DefaultWatchInterval = 100 * time.Millisecond // DefaultWatchTimeout is the default watch timeout. DefaultWatchTimeout = 5 * time.Second )
const ( // DefaultReadBufferSize is the default maximum read buffer size. DefaultReadBufferSize = 25 * 1024 * 1024 // DefaultWriteBufferSize is the default maximum write buffer size. DefaultWriteBufferSize = 10 * 1024 * 1024 )
Variables ¶
var ( // ErrUnsupportedProtocolType is the unsupported protocol type error. ErrUnsupportedProtocolType = errors.New("unsupported protocol type") // ErrUnsupportedProtocolVersion is the unsupported protocol version error. ErrUnsupportedProtocolVersion = errors.New("unsupported protocol version") )
Functions ¶
This section is empty.
Types ¶
type Chrome ¶
type Chrome struct { Description string `json:"description,omitempty"` DevtoolsURL string `json:"devtoolsFrontendUrl,omitempty"` ID string `json:"id,omitempty"` Title string `json:"title,omitempty"` Type TargetType `json:"type,omitempty"` URL string `json:"url,omitempty"` WebsocketURL string `json:"webSocketDebuggerUrl,omitempty"` FaviconURL string `json:"faviconURL,omitempty"` }
Chrome holds connection information for a Chrome, Edge, or Safari target.
func (*Chrome) GetWebsocketURL ¶
GetWebsocketURL provides the websocket URL for the target, satisfying the domains.Target interface.
func (Chrome) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Chrome) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Chrome) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Chrome) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a Chrome Debugging Protocol client.
func (*Client) ActivateTarget ¶
ActivateTarget activates a target.
func (*Client) CloseTarget ¶
CloseTarget activates a target.
func (*Client) ListPageTargets ¶
ListPageTargets lists the available Page targets.
func (*Client) ListTargets ¶
ListTargets returns a list of all targets.
func (*Client) ListTargetsWithType ¶
ListTargetsWithType returns a list of Targets with the specified target type.
func (*Client) NewPageTarget ¶
NewPageTarget creates a new page target.
func (*Client) NewPageTargetWithURL ¶
NewPageTargetWithURL creates a new page target with the specified url.
func (*Client) VersionInfo ¶
VersionInfo returns information about the remote debugging protocol.
type Option ¶
type Option func(*Client)
Option is a Chrome Debugging Protocol client option.
func WatchInterval ¶
WatchInterval is a client option that specifies the check interval duration.
func WatchTimeout ¶
WatchTimeout is a client option that specifies the watch timeout duration.
type Target ¶
type Target interface { String() string GetID() string GetType() TargetType GetWebsocketURL() string }
Target is the common interface for a Chrome Debugging Protocol target.
type TargetType ¶
type TargetType string
TargetType are the types of targets available in Chrome.
const ( BackgroundPage TargetType = "background_page" Other TargetType = "other" Page TargetType = "page" ServiceWorker TargetType = "service_worker" Node TargetType = "node" )
TargetType values.
func (TargetType) MarshalEasyJSON ¶
func (tt TargetType) MarshalEasyJSON(out *jwriter.Writer)
MarshalEasyJSON satisfies easyjson.Marshaler.
func (TargetType) MarshalJSON ¶
func (tt TargetType) MarshalJSON() ([]byte, error)
MarshalJSON satisfies json.Marshaler.
func (*TargetType) UnmarshalEasyJSON ¶
func (tt *TargetType) UnmarshalEasyJSON(in *jlexer.Lexer)
UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (*TargetType) UnmarshalJSON ¶
func (tt *TargetType) UnmarshalJSON(buf []byte) error
UnmarshalJSON satisfies json.Unmarshaler.