cdp

package
v0.0.0-...-84e4751 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 29 Imported by: 1

Documentation

Overview

Package cdp implements the Chrome DevTools Protocol HTML driver.

Index

Constants

View Source
const (
	DefaultAddress    = "http://127.0.0.1:9222"
	DefaultBufferSize = 1048562
)
View Source
const BlankPageURL = "about:blank"
View Source
const DriverName = "cdp"

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionOptions

type ConnectionOptions struct {
	BufferSize  int
	Compression bool
}

type Driver

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

func NewDriver

func NewDriver(opts ...Option) *Driver

func (*Driver) Close

func (drv *Driver) Close() error

func (*Driver) Name

func (drv *Driver) Name() string

func (*Driver) Open

func (drv *Driver) Open(ctx context.Context, params drivers.Params) (drivers.HTMLPage, error)

func (*Driver) Parse

func (drv *Driver) Parse(ctx context.Context, params drivers.ParseParams) (drivers.HTMLPage, error)

type HTMLPage

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

func LoadHTMLPage

func LoadHTMLPage(
	ctx context.Context,
	conn *rpcc.Conn,
	params drivers.Params,
) (p *HTMLPage, err error)

func LoadHTMLPageWithContent

func LoadHTMLPageWithContent(
	ctx context.Context,
	conn *rpcc.Conn,
	params drivers.Params,
	content []byte,
) (p *HTMLPage, err error)

func NewHTMLPage

func NewHTMLPage(
	logger zerolog.Logger,
	conn *rpcc.Conn,
	client *cdp.Client,
	netManager *net.Manager,
	domManager *dom.Manager,
) *HTMLPage

func (*HTMLPage) CaptureScreenshot

func (p *HTMLPage) CaptureScreenshot(ctx context.Context, params drivers.ScreenshotParams) (runtime.Binary, error)

func (*HTMLPage) Close

func (p *HTMLPage) Close() error

func (*HTMLPage) Compare

func (p *HTMLPage) Compare(other runtime.Value) int

func (*HTMLPage) Copy

func (p *HTMLPage) Copy() runtime.Value

func (*HTMLPage) DeleteCookies

func (p *HTMLPage) DeleteCookies(ctx context.Context, cookies *drivers.HTTPCookies) error

func (*HTMLPage) Dispatch

func (p *HTMLPage) Dispatch(ctx context.Context, event runtime.DispatchEvent) error

func (*HTMLPage) Get

func (p *HTMLPage) Get(ctx context.Context, key runtime.Value) (runtime.Value, error)

func (*HTMLPage) GetCookies

func (p *HTMLPage) GetCookies(ctx context.Context) (*drivers.HTTPCookies, error)

func (*HTMLPage) GetFrame

func (p *HTMLPage) GetFrame(ctx context.Context, idx runtime.Int) (runtime.Value, error)

func (*HTMLPage) GetFrames

func (p *HTMLPage) GetFrames(ctx context.Context) (runtime.List, error)

func (*HTMLPage) GetMainFrame

func (p *HTMLPage) GetMainFrame() drivers.HTMLDocument

func (*HTMLPage) GetResponse

func (p *HTMLPage) GetResponse(ctx context.Context) (drivers.HTTPResponse, error)

func (*HTMLPage) GetURL

func (p *HTMLPage) GetURL() runtime.String

func (*HTMLPage) Hash

func (p *HTMLPage) Hash() uint64

func (*HTMLPage) IsClosed

func (p *HTMLPage) IsClosed() runtime.Boolean

func (*HTMLPage) Iterate

func (p *HTMLPage) Iterate(ctx context.Context) (runtime.Iterator, error)

func (*HTMLPage) Length

func (p *HTMLPage) Length(ctx context.Context) (runtime.Int, error)

func (*HTMLPage) MarshalJSON

func (p *HTMLPage) MarshalJSON() ([]byte, error)

func (*HTMLPage) Navigate

func (p *HTMLPage) Navigate(ctx context.Context, url runtime.String) error

func (*HTMLPage) NavigateBack

func (p *HTMLPage) NavigateBack(ctx context.Context, skip runtime.Int) (runtime.Boolean, error)

func (*HTMLPage) NavigateForward

func (p *HTMLPage) NavigateForward(ctx context.Context, skip runtime.Int) (runtime.Boolean, error)

func (*HTMLPage) PrintToPDF

func (p *HTMLPage) PrintToPDF(ctx context.Context, params drivers.PDFParams) (runtime.Binary, error)

func (*HTMLPage) Set

func (p *HTMLPage) Set(ctx context.Context, key runtime.Value, value runtime.Value) error

func (*HTMLPage) SetCookies

func (p *HTMLPage) SetCookies(ctx context.Context, cookies *drivers.HTTPCookies) error

func (*HTMLPage) String

func (p *HTMLPage) String() string

func (*HTMLPage) Subscribe

func (p *HTMLPage) Subscribe(ctx context.Context, subscription runtime.Subscription) (runtime.Stream, error)

func (*HTMLPage) Type

func (p *HTMLPage) Type() runtime.Type

func (*HTMLPage) Unwrap

func (p *HTMLPage) Unwrap() any

func (*HTMLPage) WaitForFrameNavigation

func (p *HTMLPage) WaitForFrameNavigation(ctx context.Context, frame drivers.HTMLDocument, targetURL runtime.String) error

func (*HTMLPage) WaitForNavigation

func (p *HTMLPage) WaitForNavigation(ctx context.Context, targetURL runtime.String) error

type HTMLPageEvent

type HTMLPageEvent string

type Option

type Option func(opts *Options)

func WithAddress

func WithAddress(address string) Option

func WithBufferSize

func WithBufferSize(size int) Option

func WithCompression

func WithCompression() Option

func WithCookie

func WithCookie(cookie drivers.HTTPCookie) Option

func WithCookies

func WithCookies(cookies []drivers.HTTPCookie) Option

func WithCustomName

func WithCustomName(name string) Option

func WithHeader

func WithHeader(name string, header []string) Option

func WithHeaders

func WithHeaders(headers textproto.MIMEHeader) Option

func WithKeepCookies

func WithKeepCookies() Option

func WithNoCompression

func WithNoCompression() Option

func WithProxy

func WithProxy(address string) Option

func WithUserAgent

func WithUserAgent(value string) Option

type Options

type Options struct {
	*drivers.Options
	Connection  *ConnectionOptions
	Address     string
	KeepCookies bool
}

func NewOptions

func NewOptions(setters []Option) *Options

Directories

Path Synopsis
Package dom provides DOM helpers for the CDP HTML driver.
Package dom provides DOM helpers for the CDP HTML driver.
Package eval builds JavaScript evaluation helpers for the CDP HTML driver.
Package eval builds JavaScript evaluation helpers for the CDP HTML driver.
Package events provides event stream helpers for the CDP HTML driver.
Package events provides event stream helpers for the CDP HTML driver.
Package input provides input emulation helpers for the CDP HTML driver.
Package input provides input emulation helpers for the CDP HTML driver.
Package network provides network management for the CDP HTML driver.
Package network provides network management for the CDP HTML driver.
Package templates provides JavaScript templates for the CDP HTML driver.
Package templates provides JavaScript templates for the CDP HTML driver.
Package utils provides utility helpers for the CDP HTML driver.
Package utils provides utility helpers for the CDP HTML driver.

Jump to

Keyboard shortcuts

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