Documentation ¶
Overview ¶
Package client provides the low level Chrome DevTools Protocol client.
Index ¶
- Constants
- Variables
- type Chrome
- func (c *Chrome) GetDevtoolsURL() string
- 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 Error
- type Option
- type Target
- type TargetType
- type Transport
Constants ¶
const ( // DefaultEndpoint is the default endpoint to connect to. DefaultEndpoint = "http://localhost:9222/json" // DefaultWatchInterval is the default check duration. DefaultWatchInterval = 100 * time.Millisecond // DefaultWatchTimeout is the default watch timeout. DefaultWatchTimeout = 5 * time.Second )
Variables ¶
var ( // DefaultReadBufferSize is the default maximum read buffer size. DefaultReadBufferSize = 25 * 1024 * 1024 // DefaultWriteBufferSize is the default maximum write buffer size. DefaultWriteBufferSize = 10 * 1024 * 1024 )
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 target.
func (*Chrome) GetDevtoolsURL ¶
GetDevtoolsURL returns the devtools frontend target URL, satisfying the domains.Target interface.
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 DevTools 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 DevTools Protocol client option.
func URL ¶
URL is a client option to specify the remote Chrome DevTools Protocol instance to connect to.
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 GetDevtoolsURL() string GetWebsocketURL() string }
Target is the common interface for a Chrome DevTools Protocol target.
type TargetType ¶
type TargetType string
TargetType are the types of targets available in Chrome.
const ( App TargetType = "app" BackgroundPage TargetType = "background_page" Browser TargetType = "browser" External TargetType = "external" Iframe TargetType = "iframe" Other TargetType = "other" Page TargetType = "page" ServiceWorker TargetType = "service_worker" Webview TargetType = "webview" Worker TargetType = "worker" )
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.