cdp

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2018 License: MIT Imports: 32 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const BlankPageURL = "about:blank"
View Source
const DefaultAddress = "http://127.0.0.1:9222"
View Source
const DefaultTimeout = time.Second * 30

Variables

This section is empty.

Functions

This section is empty.

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) GetDocument

func (drv *Driver) GetDocument(ctx context.Context, targetURL values.String) (values.DHTMLDocument, error)

type HTMLDocument

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

func LoadHTMLDocument

func LoadHTMLDocument(
	ctx context.Context,
	conn *rpcc.Conn,
	client *cdp.Client,
	url string,
) (*HTMLDocument, error)

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(params values.HTMLScreenshotParams) (values.Binary, error)

func (*HTMLDocument) ClickBySelector

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

func (*HTMLDocument) ClickBySelectorAll

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

func (*HTMLDocument) Close

func (doc *HTMLDocument) Close() error

func (*HTMLDocument) Compare

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

func (*HTMLDocument) Copy

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

func (*HTMLDocument) CountBySelector

func (doc *HTMLDocument) CountBySelector(selector values.String) values.Int

func (*HTMLDocument) ExistsBySelector

func (doc *HTMLDocument) ExistsBySelector(selector values.String) values.Boolean

func (*HTMLDocument) GetAttribute

func (doc *HTMLDocument) GetAttribute(name values.String) core.Value

func (*HTMLDocument) GetAttributes

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

func (*HTMLDocument) GetChildNode

func (doc *HTMLDocument) GetChildNode(idx values.Int) core.Value

func (*HTMLDocument) GetChildNodes

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

func (*HTMLDocument) Hash

func (doc *HTMLDocument) Hash() uint64

func (*HTMLDocument) HoverBySelector

func (doc *HTMLDocument) HoverBySelector(selector values.String) error

func (*HTMLDocument) InnerHTML

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

func (*HTMLDocument) InnerHTMLBySelector

func (doc *HTMLDocument) InnerHTMLBySelector(selector values.String) values.String

func (*HTMLDocument) InnerHTMLBySelectorAll

func (doc *HTMLDocument) InnerHTMLBySelectorAll(selector values.String) *values.Array

func (*HTMLDocument) InnerText

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

func (*HTMLDocument) InnerTextBySelector

func (doc *HTMLDocument) InnerTextBySelector(selector values.String) values.String

func (*HTMLDocument) InnerTextBySelectorAll

func (doc *HTMLDocument) InnerTextBySelectorAll(selector values.String) *values.Array

func (*HTMLDocument) InputBySelector

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

func (*HTMLDocument) Length

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

func (*HTMLDocument) MarshalJSON

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

func (*HTMLDocument) Navigate

func (doc *HTMLDocument) Navigate(url values.String, timeout values.Int) error

func (*HTMLDocument) NavigateBack

func (doc *HTMLDocument) NavigateBack(skip values.Int, timeout values.Int) (values.Boolean, error)

func (*HTMLDocument) NavigateForward

func (doc *HTMLDocument) NavigateForward(skip values.Int, timeout 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(params values.HTMLPDFParams) (values.Binary, error)

func (*HTMLDocument) QuerySelector

func (doc *HTMLDocument) QuerySelector(selector values.String) core.Value

func (*HTMLDocument) QuerySelectorAll

func (doc *HTMLDocument) QuerySelectorAll(selector values.String) core.Value

func (*HTMLDocument) ScrollBottom

func (doc *HTMLDocument) ScrollBottom() error

func (*HTMLDocument) ScrollBySelector

func (doc *HTMLDocument) ScrollBySelector(selector values.String) error

func (*HTMLDocument) ScrollTop

func (doc *HTMLDocument) ScrollTop() error

func (*HTMLDocument) SelectBySelector

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

func (*HTMLDocument) String

func (doc *HTMLDocument) String() string

func (*HTMLDocument) Type

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

func (*HTMLDocument) URL

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

func (*HTMLDocument) Unwrap

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

func (*HTMLDocument) Value

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

func (*HTMLDocument) WaitForClass

func (doc *HTMLDocument) WaitForClass(selector, class values.String, timeout values.Int) error

func (*HTMLDocument) WaitForClassAll

func (doc *HTMLDocument) WaitForClassAll(selector, class values.String, timeout values.Int) error

func (*HTMLDocument) WaitForNavigation

func (doc *HTMLDocument) WaitForNavigation(timeout values.Int) error

func (*HTMLDocument) WaitForSelector

func (doc *HTMLDocument) WaitForSelector(selector values.String, timeout values.Int) 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,
	attributes []string,
	value string,
	innerHTML values.String,
	children []*HTMLElementIdentity,
) *HTMLElement

func (*HTMLElement) Click

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

func (*HTMLElement) Close

func (el *HTMLElement) Close() error

func (*HTMLElement) Compare

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

func (*HTMLElement) Copy

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

func (*HTMLElement) CountBySelector

func (el *HTMLElement) CountBySelector(selector values.String) values.Int

func (*HTMLElement) ExistsBySelector

func (el *HTMLElement) ExistsBySelector(selector values.String) values.Boolean

func (*HTMLElement) GetAttribute

func (el *HTMLElement) GetAttribute(name values.String) core.Value

func (*HTMLElement) GetAttributes

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

func (*HTMLElement) GetChildNode

func (el *HTMLElement) GetChildNode(idx values.Int) core.Value

func (*HTMLElement) GetChildNodes

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

func (*HTMLElement) Hash

func (el *HTMLElement) Hash() uint64

func (*HTMLElement) Hover

func (el *HTMLElement) Hover() error

func (*HTMLElement) InnerHTML

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

func (*HTMLElement) InnerHTMLBySelector

func (el *HTMLElement) InnerHTMLBySelector(selector values.String) values.String

func (*HTMLElement) InnerHTMLBySelectorAll

func (el *HTMLElement) InnerHTMLBySelectorAll(selector values.String) *values.Array

func (*HTMLElement) InnerText

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

func (*HTMLElement) InnerTextBySelector

func (el *HTMLElement) InnerTextBySelector(selector values.String) values.String

func (*HTMLElement) InnerTextBySelectorAll

func (el *HTMLElement) InnerTextBySelectorAll(selector values.String) *values.Array

func (*HTMLElement) Input

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

func (*HTMLElement) IsConnected

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

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(selector values.String) core.Value

func (*HTMLElement) QuerySelectorAll

func (el *HTMLElement) QuerySelectorAll(selector values.String) core.Value

func (*HTMLElement) ScrollIntoView

func (el *HTMLElement) ScrollIntoView() error

func (*HTMLElement) Select

func (el *HTMLElement) Select(value *values.Array) (*values.Array, 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) Value

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

func (*HTMLElement) WaitForClass

func (el *HTMLElement) WaitForClass(class values.String, timeout values.Int) 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 WithProxy

func WithProxy(address string) Option

func WithUserAgent

func WithUserAgent(value string) Option

type Options

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

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