cdp

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2019 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func LoadHTMLDocument

func LoadHTMLDocument(
	ctx context.Context,
	conn *rpcc.Conn,
	client *cdp.Client,
	params drivers.LoadDocumentParams,
) (drivers.HTMLDocument, error)

Types

type Driver

type Driver struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewDriver

func NewDriver(opts ...Option) *Driver

func (*Driver) Close

func (drv *Driver) Close() error

func (*Driver) LoadDocument added in v0.7.0

func (drv *Driver) LoadDocument(ctx context.Context, params drivers.LoadDocumentParams) (drivers.HTMLDocument, error)

func (*Driver) Name added in v0.7.0

func (drv *Driver) Name() string

type HTMLDocument

type HTMLDocument struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewHTMLDocument

func NewHTMLDocument(
	logger *zerolog.Logger,
	conn *rpcc.Conn,
	client *cdp.Client,
	broker *events.EventBroker,
	url values.String,
	rootElement *HTMLElement,
) *HTMLDocument

func (*HTMLDocument) CaptureScreenshot

func (doc *HTMLDocument) CaptureScreenshot(ctx context.Context, params drivers.ScreenshotParams) (values.Binary, error)

func (*HTMLDocument) ClickBySelector

func (doc *HTMLDocument) ClickBySelector(ctx context.Context, selector values.String) (values.Boolean, error)

func (*HTMLDocument) ClickBySelectorAll

func (doc *HTMLDocument) ClickBySelectorAll(ctx context.Context, selector values.String) (values.Boolean, error)

func (*HTMLDocument) Close

func (doc *HTMLDocument) Close() error

func (*HTMLDocument) Compare

func (doc *HTMLDocument) Compare(other core.Value) int64

func (*HTMLDocument) Copy

func (doc *HTMLDocument) Copy() core.Value

func (*HTMLDocument) CountBySelector

func (doc *HTMLDocument) CountBySelector(ctx context.Context, selector values.String) values.Int

func (*HTMLDocument) DeleteCookies added in v0.7.0

func (doc *HTMLDocument) DeleteCookies(ctx context.Context, cookies ...drivers.HTTPCookie) error

func (*HTMLDocument) DocumentElement added in v0.7.0

func (doc *HTMLDocument) DocumentElement() drivers.HTMLElement

func (*HTMLDocument) ExistsBySelector

func (doc *HTMLDocument) ExistsBySelector(ctx context.Context, selector values.String) values.Boolean

func (*HTMLDocument) GetChildNode

func (doc *HTMLDocument) GetChildNode(ctx context.Context, idx values.Int) core.Value

func (*HTMLDocument) GetChildNodes

func (doc *HTMLDocument) GetChildNodes(ctx context.Context) core.Value

func (*HTMLDocument) GetCookies added in v0.7.0

func (doc *HTMLDocument) GetCookies(ctx context.Context) (*values.Array, error)

func (*HTMLDocument) GetIn added in v0.7.0

func (doc *HTMLDocument) GetIn(ctx context.Context, path []core.Value) (core.Value, error)

func (*HTMLDocument) GetURL added in v0.7.0

func (doc *HTMLDocument) GetURL() core.Value

func (*HTMLDocument) Hash

func (doc *HTMLDocument) Hash() uint64

func (*HTMLDocument) InputBySelector

func (doc *HTMLDocument) InputBySelector(ctx context.Context, selector values.String, value core.Value, delay values.Int) (values.Boolean, error)

func (*HTMLDocument) Iterate added in v0.7.0

func (doc *HTMLDocument) Iterate(ctx context.Context) (core.Iterator, error)

func (*HTMLDocument) Length

func (doc *HTMLDocument) Length() values.Int

func (*HTMLDocument) MarshalJSON

func (doc *HTMLDocument) MarshalJSON() ([]byte, error)

func (*HTMLDocument) MoveMouseBySelector added in v0.7.0

func (doc *HTMLDocument) MoveMouseBySelector(ctx context.Context, selector values.String) error

func (*HTMLDocument) MoveMouseByXY added in v0.7.0

func (doc *HTMLDocument) MoveMouseByXY(ctx context.Context, x, y values.Float) error

func (*HTMLDocument) Navigate

func (doc *HTMLDocument) Navigate(ctx context.Context, url values.String) error

func (*HTMLDocument) NavigateBack

func (doc *HTMLDocument) NavigateBack(ctx context.Context, skip values.Int) (values.Boolean, error)

func (*HTMLDocument) NavigateForward

func (doc *HTMLDocument) NavigateForward(ctx context.Context, skip values.Int) (values.Boolean, error)

func (*HTMLDocument) NodeName

func (doc *HTMLDocument) NodeName() values.String

func (*HTMLDocument) NodeType

func (doc *HTMLDocument) NodeType() values.Int

func (*HTMLDocument) PrintToPDF

func (doc *HTMLDocument) PrintToPDF(ctx context.Context, params drivers.PDFParams) (values.Binary, error)

func (*HTMLDocument) QuerySelector

func (doc *HTMLDocument) QuerySelector(ctx context.Context, selector values.String) core.Value

func (*HTMLDocument) QuerySelectorAll

func (doc *HTMLDocument) QuerySelectorAll(ctx context.Context, selector values.String) core.Value

func (*HTMLDocument) ScrollBottom

func (doc *HTMLDocument) ScrollBottom(ctx context.Context) error

func (*HTMLDocument) ScrollBySelector

func (doc *HTMLDocument) ScrollBySelector(ctx context.Context, selector values.String) error

func (*HTMLDocument) ScrollByXY added in v0.7.0

func (doc *HTMLDocument) ScrollByXY(ctx context.Context, x, y values.Float) error

func (*HTMLDocument) ScrollTop

func (doc *HTMLDocument) ScrollTop(ctx context.Context) error

func (*HTMLDocument) SelectBySelector

func (doc *HTMLDocument) SelectBySelector(ctx context.Context, selector values.String, value *values.Array) (*values.Array, error)

func (*HTMLDocument) SetCookies added in v0.7.0

func (doc *HTMLDocument) SetCookies(ctx context.Context, cookies ...drivers.HTTPCookie) error

func (*HTMLDocument) SetIn added in v0.7.0

func (doc *HTMLDocument) SetIn(ctx context.Context, path []core.Value, value core.Value) error

func (*HTMLDocument) SetURL added in v0.7.0

func (doc *HTMLDocument) SetURL(ctx context.Context, url values.String) error

func (*HTMLDocument) String

func (doc *HTMLDocument) String() string

func (*HTMLDocument) Type

func (doc *HTMLDocument) Type() core.Type

func (*HTMLDocument) Unwrap

func (doc *HTMLDocument) Unwrap() interface{}

func (*HTMLDocument) WaitForAttributeBySelector added in v0.7.0

func (doc *HTMLDocument) WaitForAttributeBySelector(
	ctx context.Context,
	selector,
	name values.String,
	value core.Value,
	when drivers.WaitEvent,
) error

func (*HTMLDocument) WaitForAttributeBySelectorAll added in v0.7.0

func (doc *HTMLDocument) WaitForAttributeBySelectorAll(
	ctx context.Context,
	selector,
	name values.String,
	value core.Value,
	when drivers.WaitEvent,
) error

func (*HTMLDocument) WaitForClassBySelector added in v0.7.0

func (doc *HTMLDocument) WaitForClassBySelector(ctx context.Context, selector, class values.String, when drivers.WaitEvent) error

func (*HTMLDocument) WaitForClassBySelectorAll added in v0.7.0

func (doc *HTMLDocument) WaitForClassBySelectorAll(ctx context.Context, selector, class values.String, when drivers.WaitEvent) error

func (*HTMLDocument) WaitForElement added in v0.7.0

func (doc *HTMLDocument) WaitForElement(ctx context.Context, selector values.String, when drivers.WaitEvent) error

func (*HTMLDocument) WaitForNavigation

func (doc *HTMLDocument) WaitForNavigation(ctx context.Context) error

func (*HTMLDocument) WaitForStyleBySelector added in v0.7.0

func (doc *HTMLDocument) WaitForStyleBySelector(ctx context.Context, selector, name values.String, value core.Value, when drivers.WaitEvent) error

func (*HTMLDocument) WaitForStyleBySelectorAll added in v0.7.0

func (doc *HTMLDocument) WaitForStyleBySelectorAll(ctx context.Context, selector, name values.String, value core.Value, when drivers.WaitEvent) error

type HTMLElement

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

func LoadElement

func LoadElement(
	ctx context.Context,
	logger *zerolog.Logger,
	client *cdp.Client,
	broker *events.EventBroker,
	nodeID dom.NodeID,
	backendID dom.BackendNodeID,
) (*HTMLElement, error)

func NewHTMLElement

func NewHTMLElement(
	logger *zerolog.Logger,
	client *cdp.Client,
	broker *events.EventBroker,
	id *HTMLElementIdentity,
	nodeType int,
	nodeName string,
	value string,
	innerHTML values.String,
	children []*HTMLElementIdentity,
) *HTMLElement

func (*HTMLElement) Click

func (el *HTMLElement) Click(ctx context.Context) (values.Boolean, error)

func (*HTMLElement) Close

func (el *HTMLElement) Close() error

func (*HTMLElement) Compare

func (el *HTMLElement) Compare(other core.Value) int64

func (*HTMLElement) Copy

func (el *HTMLElement) Copy() core.Value

func (*HTMLElement) CountBySelector

func (el *HTMLElement) CountBySelector(ctx context.Context, selector values.String) values.Int

func (*HTMLElement) ExistsBySelector

func (el *HTMLElement) ExistsBySelector(ctx context.Context, selector values.String) values.Boolean

func (*HTMLElement) GetAttribute

func (el *HTMLElement) GetAttribute(ctx context.Context, name values.String) core.Value

func (*HTMLElement) GetAttributes

func (el *HTMLElement) GetAttributes(ctx context.Context) *values.Object

func (*HTMLElement) GetChildNode

func (el *HTMLElement) GetChildNode(ctx context.Context, idx values.Int) core.Value

func (*HTMLElement) GetChildNodes

func (el *HTMLElement) GetChildNodes(ctx context.Context) core.Value

func (*HTMLElement) GetIn added in v0.7.0

func (el *HTMLElement) GetIn(ctx context.Context, path []core.Value) (core.Value, error)

func (*HTMLElement) GetStyle added in v0.7.0

func (el *HTMLElement) GetStyle(ctx context.Context, name values.String) (core.Value, error)

func (*HTMLElement) GetStyles added in v0.7.0

func (el *HTMLElement) GetStyles(ctx context.Context) (*values.Object, error)

func (*HTMLElement) GetValue added in v0.7.0

func (el *HTMLElement) GetValue(ctx context.Context) core.Value

func (*HTMLElement) Hash

func (el *HTMLElement) Hash() uint64

func (*HTMLElement) Hover

func (el *HTMLElement) Hover(ctx context.Context) error

func (*HTMLElement) InnerHTML

func (el *HTMLElement) InnerHTML(_ context.Context) values.String

func (*HTMLElement) InnerHTMLBySelector

func (el *HTMLElement) InnerHTMLBySelector(ctx context.Context, selector values.String) values.String

func (*HTMLElement) InnerHTMLBySelectorAll

func (el *HTMLElement) InnerHTMLBySelectorAll(ctx context.Context, selector values.String) *values.Array

func (*HTMLElement) InnerText

func (el *HTMLElement) InnerText(ctx context.Context) values.String

func (*HTMLElement) InnerTextBySelector

func (el *HTMLElement) InnerTextBySelector(ctx context.Context, selector values.String) values.String

func (*HTMLElement) InnerTextBySelectorAll

func (el *HTMLElement) InnerTextBySelectorAll(ctx context.Context, selector values.String) *values.Array

func (*HTMLElement) Input

func (el *HTMLElement) Input(ctx context.Context, value core.Value, delay values.Int) error

func (*HTMLElement) IsConnected

func (el *HTMLElement) IsConnected() values.Boolean

func (*HTMLElement) Iterate added in v0.7.0

func (el *HTMLElement) Iterate(_ context.Context) (core.Iterator, error)

func (*HTMLElement) Length

func (el *HTMLElement) Length() values.Int

func (*HTMLElement) MarshalJSON

func (el *HTMLElement) MarshalJSON() ([]byte, error)

func (*HTMLElement) NodeName

func (el *HTMLElement) NodeName() values.String

func (*HTMLElement) NodeType

func (el *HTMLElement) NodeType() values.Int

func (*HTMLElement) QuerySelector

func (el *HTMLElement) QuerySelector(ctx context.Context, selector values.String) core.Value

func (*HTMLElement) QuerySelectorAll

func (el *HTMLElement) QuerySelectorAll(ctx context.Context, selector values.String) core.Value

func (*HTMLElement) RemoveAttribute added in v0.7.0

func (el *HTMLElement) RemoveAttribute(ctx context.Context, names ...values.String) error

func (*HTMLElement) RemoveStyle added in v0.7.0

func (el *HTMLElement) RemoveStyle(ctx context.Context, names ...values.String) error

func (*HTMLElement) ScrollIntoView

func (el *HTMLElement) ScrollIntoView(ctx context.Context) error

func (*HTMLElement) Select

func (el *HTMLElement) Select(ctx context.Context, value *values.Array) (*values.Array, error)

func (*HTMLElement) SetAttribute added in v0.7.0

func (el *HTMLElement) SetAttribute(ctx context.Context, name, value values.String) error

func (*HTMLElement) SetAttributes added in v0.7.0

func (el *HTMLElement) SetAttributes(ctx context.Context, attrs *values.Object) error

func (*HTMLElement) SetIn added in v0.7.0

func (el *HTMLElement) SetIn(ctx context.Context, path []core.Value, value core.Value) error

func (*HTMLElement) SetStyle added in v0.7.0

func (el *HTMLElement) SetStyle(ctx context.Context, name values.String, value core.Value) error

func (*HTMLElement) SetStyles added in v0.7.0

func (el *HTMLElement) SetStyles(ctx context.Context, styles *values.Object) error

func (*HTMLElement) SetValue added in v0.7.0

func (el *HTMLElement) SetValue(ctx context.Context, value core.Value) error

func (*HTMLElement) String

func (el *HTMLElement) String() string

func (*HTMLElement) Type

func (el *HTMLElement) Type() core.Type

func (*HTMLElement) Unwrap

func (el *HTMLElement) Unwrap() interface{}

func (*HTMLElement) WaitForAttribute added in v0.7.0

func (el *HTMLElement) WaitForAttribute(
	ctx context.Context,
	name values.String,
	value core.Value,
	when drivers.WaitEvent,
) error

func (*HTMLElement) WaitForClass

func (el *HTMLElement) WaitForClass(ctx context.Context, class values.String, when drivers.WaitEvent) error

func (*HTMLElement) WaitForStyle added in v0.7.0

func (el *HTMLElement) WaitForStyle(ctx context.Context, name values.String, value core.Value, when drivers.WaitEvent) error

type HTMLElementIdentity

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

type Option

type Option func(opts *Options)

func WithAddress

func WithAddress(address string) Option

func WithCustomName added in v0.7.0

func WithCustomName(name string) Option

func WithKeepCookies added in v0.7.0

func WithKeepCookies() Option

func WithProxy

func WithProxy(address string) Option

func WithUserAgent

func WithUserAgent(value string) Option

type Options

type Options struct {
	Name        string
	Proxy       string
	UserAgent   string
	Address     string
	KeepCookies bool
}

type Quad

type Quad struct {
	X float64
	Y float64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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