Help us shape the future of Go! Take the 2026 Go Developer Survey

cdp

package
v1.30.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClosed = errors.New("cdp: connection closed")

Functions

func Discover

func Discover(ctx context.Context, endpoint string) (string, error)

func EndpointClient added in v1.29.3

func EndpointClient(rt http.RoundTripper, timeout time.Duration) *http.Client

Types

type BindingCalled

type BindingCalled struct {
	Name               string `json:"name"`
	Payload            string `json:"payload"`
	ExecutionContextID int    `json:"executionContextId"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func Dial

func Dial(ctx context.Context, endpoint string) (*Client, error)

func (*Client) Attach

func (c *Client) Attach(ctx context.Context, targetID string) (*Session, error)

func (*Client) Call

func (c *Client) Call(ctx context.Context, sessionID, method string, params, result any) error

func (*Client) Close

func (c *Client) Close() error

func (*Client) Done

func (c *Client) Done() <-chan struct{}

func (*Client) Err

func (c *Client) Err() error

func (*Client) Subscribe

func (c *Client) Subscribe() *Subscription

func (*Client) Targets

func (c *Client) Targets(ctx context.Context) ([]TargetInfo, error)

type Error

type Error struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    string `json:"data,omitempty"`
}

func (*Error) Error

func (e *Error) Error() string

type EvaluateOptions

type EvaluateOptions struct {
	ContextID     int
	AwaitPromise  bool
	ReturnByValue bool
}

type Event

type Event struct {
	SessionID string
	Method    string
	Params    json.RawMessage
}

type ExceptionError

type ExceptionError struct {
	Text string
}

func (*ExceptionError) Error

func (e *ExceptionError) Error() string

type ExecutionContext

type ExecutionContext struct {
	ID       int    `json:"id"`
	Origin   string `json:"origin"`
	Name     string `json:"name"`
	UniqueID string `json:"uniqueId"`
	AuxData  struct {
		IsDefault bool   `json:"isDefault"`
		Type      string `json:"type"`
		FrameID   string `json:"frameId"`
	} `json:"auxData"`
}

type Session

type Session struct {
	Client *Client
	ID     string
}

func (*Session) AddBinding

func (s *Session) AddBinding(ctx context.Context, name string) error

func (*Session) Call

func (s *Session) Call(ctx context.Context, method string, params, result any) error

func (*Session) Detach

func (s *Session) Detach(ctx context.Context) error

func (*Session) Evaluate

func (s *Session) Evaluate(ctx context.Context, expression string, opts EvaluateOptions, result any) error

type Subscription

type Subscription struct {
	// contains filtered or unexported fields
}

func (*Subscription) Close

func (s *Subscription) Close()

func (*Subscription) Events

func (s *Subscription) Events() <-chan Event

type TargetInfo

type TargetInfo struct {
	TargetID string `json:"targetId"`
	Type     string `json:"type"`
	Title    string `json:"title"`
	URL      string `json:"url"`
	Attached bool   `json:"attached"`
}

Jump to

Keyboard shortcuts

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