dom

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2020 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttrModifiedListener

type AttrModifiedListener func(ctx context.Context, nodeID dom.NodeID, name, value string)

type AttrRemovedListener

type AttrRemovedListener func(ctx context.Context, nodeID dom.NodeID, name string)

type ChildNodeCountUpdatedListener

type ChildNodeCountUpdatedListener func(ctx context.Context, nodeID dom.NodeID, count int)

type ChildNodeInsertedListener

type ChildNodeInsertedListener func(ctx context.Context, nodeID, previousNodeID dom.NodeID, node dom.Node)

type ChildNodeRemovedListener

type ChildNodeRemovedListener func(ctx context.Context, nodeID, previousNodeID dom.NodeID)

type DocumentUpdatedListener

type DocumentUpdatedListener func(ctx context.Context)

type Frame

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

type HTMLDocument

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

func LoadHTMLDocument

func LoadHTMLDocument(
	ctx context.Context,
	logger *zerolog.Logger,
	client *cdp.Client,
	domManager *Manager,
	mouse *input.Mouse,
	keyboard *input.Keyboard,
	node dom.Node,
	frameTree page.FrameTree,
	execID runtime.ExecutionContextID,
) (*HTMLDocument, error)

func LoadRootHTMLDocument

func LoadRootHTMLDocument(
	ctx context.Context,
	logger *zerolog.Logger,
	client *cdp.Client,
	domManager *Manager,
	mouse *input.Mouse,
	keyboard *input.Keyboard,
) (*HTMLDocument, error)

func NewHTMLDocument

func NewHTMLDocument(
	logger *zerolog.Logger,
	client *cdp.Client,
	domManager *Manager,
	input *input.Manager,
	exec *eval.ExecutionContext,
	rootElement *HTMLElement,
	frames page.FrameTree,
) *HTMLDocument

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, error)

func (*HTMLDocument) ExistsBySelector

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

func (*HTMLDocument) Frame

func (doc *HTMLDocument) Frame() page.FrameTree

func (*HTMLDocument) GetChildDocuments

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

func (*HTMLDocument) GetChildNode

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

func (*HTMLDocument) GetChildNodes

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

func (*HTMLDocument) GetElement

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

func (*HTMLDocument) GetIn

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

func (*HTMLDocument) GetName

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

func (*HTMLDocument) GetNodeName

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

func (*HTMLDocument) GetNodeType

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

func (*HTMLDocument) GetParentDocument

func (doc *HTMLDocument) GetParentDocument(ctx context.Context) (drivers.HTMLDocument, error)

func (*HTMLDocument) GetTitle

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

func (*HTMLDocument) GetURL

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

func (*HTMLDocument) Hash

func (doc *HTMLDocument) Hash() uint64

func (*HTMLDocument) IsDetached

func (doc *HTMLDocument) IsDetached() values.Boolean

func (*HTMLDocument) Iterate

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

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

func (*HTMLDocument) QuerySelector

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

func (*HTMLDocument) QuerySelectorAll

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

func (*HTMLDocument) ScrollBottom

func (doc *HTMLDocument) ScrollBottom(ctx context.Context, options drivers.ScrollOptions) error

func (*HTMLDocument) ScrollBySelector

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

func (*HTMLDocument) ScrollByXY

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

func (*HTMLDocument) ScrollTop

func (doc *HTMLDocument) ScrollTop(ctx context.Context, options drivers.ScrollOptions) error

func (*HTMLDocument) SetIn

func (doc *HTMLDocument) SetIn(ctx context.Context, path []core.Value, value core.Value) 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

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

func (*HTMLDocument) WaitForAttributeBySelectorAll

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

func (*HTMLDocument) WaitForClassBySelector

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

func (*HTMLDocument) WaitForClassBySelectorAll

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

func (*HTMLDocument) WaitForElement

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

func (*HTMLDocument) WaitForStyleBySelector

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

func (*HTMLDocument) WaitForStyleBySelectorAll

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

func (*HTMLDocument) XPath

func (doc *HTMLDocument) XPath(ctx context.Context, expression values.String) (core.Value, error)

type HTMLElement

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

func LoadHTMLElement

func LoadHTMLElement(
	ctx context.Context,
	logger *zerolog.Logger,
	client *cdp.Client,
	domManager *Manager,
	input *input.Manager,
	exec *eval.ExecutionContext,
	nodeID dom.NodeID,
) (*HTMLElement, error)

func LoadHTMLElementWithID

func LoadHTMLElementWithID(
	ctx context.Context,
	logger *zerolog.Logger,
	client *cdp.Client,
	domManager *Manager,
	input *input.Manager,
	exec *eval.ExecutionContext,
	id HTMLElementIdentity,
) (*HTMLElement, error)

func NewHTMLElement

func NewHTMLElement(
	logger *zerolog.Logger,
	client *cdp.Client,
	domManager *Manager,
	input *input.Manager,
	exec *eval.ExecutionContext,
	id HTMLElementIdentity,
	nodeType int,
	nodeName string,
	children []HTMLElementIdentity,
) *HTMLElement

func (*HTMLElement) Blur

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

func (*HTMLElement) BlurBySelector

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

func (*HTMLElement) Clear

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

func (*HTMLElement) ClearBySelector

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

func (*HTMLElement) Click

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

func (*HTMLElement) ClickBySelector

func (el *HTMLElement) ClickBySelector(ctx context.Context, selector values.String, count values.Int) error

func (*HTMLElement) ClickBySelectorAll

func (el *HTMLElement) ClickBySelectorAll(ctx context.Context, selector values.String, count values.Int) 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, error)

func (*HTMLElement) ExistsBySelector

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

func (*HTMLElement) Focus

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

func (*HTMLElement) FocusBySelector

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

func (*HTMLElement) GetAttribute

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

func (*HTMLElement) GetAttributes

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

func (*HTMLElement) GetChildNode

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

func (*HTMLElement) GetChildNodes

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

func (*HTMLElement) GetIn

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

func (*HTMLElement) GetInnerHTML

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

func (*HTMLElement) GetInnerHTMLBySelector

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

func (*HTMLElement) GetInnerHTMLBySelectorAll

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

func (*HTMLElement) GetInnerText

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

func (*HTMLElement) GetInnerTextBySelector

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

func (*HTMLElement) GetInnerTextBySelectorAll

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

func (*HTMLElement) GetNodeName

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

func (*HTMLElement) GetNodeType

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

func (*HTMLElement) GetStyle

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

func (*HTMLElement) GetStyles

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

func (*HTMLElement) GetValue

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

func (*HTMLElement) Hash

func (el *HTMLElement) Hash() uint64

func (*HTMLElement) Hover

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

func (*HTMLElement) HoverBySelector

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

func (*HTMLElement) Input

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

func (*HTMLElement) InputBySelector

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

func (*HTMLElement) IsDetached

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

func (*HTMLElement) Iterate

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

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

func (*HTMLElement) QuerySelectorAll

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

func (*HTMLElement) RemoveAttribute

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

func (*HTMLElement) RemoveStyle

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

func (*HTMLElement) ScrollIntoView

func (el *HTMLElement) ScrollIntoView(ctx context.Context, options drivers.ScrollOptions) error

func (*HTMLElement) Select

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

func (*HTMLElement) SelectBySelector

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

func (*HTMLElement) SetAttribute

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

func (*HTMLElement) SetAttributes

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

func (*HTMLElement) SetIn

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

func (*HTMLElement) SetInnerHTML

func (el *HTMLElement) SetInnerHTML(ctx context.Context, innerHTML values.String) error

func (*HTMLElement) SetInnerHTMLBySelector

func (el *HTMLElement) SetInnerHTMLBySelector(ctx context.Context, selector, innerHTML values.String) error

func (*HTMLElement) SetInnerText

func (el *HTMLElement) SetInnerText(ctx context.Context, innerText values.String) error

func (*HTMLElement) SetInnerTextBySelector

func (el *HTMLElement) SetInnerTextBySelector(ctx context.Context, selector, innerText values.String) error

func (*HTMLElement) SetStyle

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

func (*HTMLElement) SetStyles

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

func (*HTMLElement) SetValue

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

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

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

func (*HTMLElement) XPath

func (el *HTMLElement) XPath(ctx context.Context, expression values.String) (result core.Value, err error)

type HTMLElementIdentity

type HTMLElementIdentity struct {
	NodeID   dom.NodeID
	ObjectID runtime.RemoteObjectID
}

type Manager

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

func New

func New(
	logger *zerolog.Logger,
	client *cdp.Client,
	eventLoop *events.Loop,
	mouse *input.Mouse,
	keyboard *input.Keyboard,
) (manager *Manager, err error)

func (*Manager) AddAttrModifiedListener

func (m *Manager) AddAttrModifiedListener(listener AttrModifiedListener) events.ListenerID

func (*Manager) AddAttrRemovedListener

func (m *Manager) AddAttrRemovedListener(listener AttrRemovedListener) events.ListenerID

func (*Manager) AddChildNodeCountUpdatedListener

func (m *Manager) AddChildNodeCountUpdatedListener(listener ChildNodeCountUpdatedListener) events.ListenerID

func (*Manager) AddChildNodeInsertedListener

func (m *Manager) AddChildNodeInsertedListener(listener ChildNodeInsertedListener) events.ListenerID

func (*Manager) AddChildNodeRemovedListener

func (m *Manager) AddChildNodeRemovedListener(listener ChildNodeRemovedListener) events.ListenerID

func (*Manager) AddDocumentUpdatedListener

func (m *Manager) AddDocumentUpdatedListener(listener DocumentUpdatedListener) events.ListenerID

func (*Manager) AddFrame

func (m *Manager) AddFrame(frame page.FrameTree)

func (*Manager) Close

func (m *Manager) Close() error

func (*Manager) GetFrameNode

func (m *Manager) GetFrameNode(ctx context.Context, frameID page.FrameID) (*HTMLDocument, error)

func (*Manager) GetFrameNodes

func (m *Manager) GetFrameNodes(ctx context.Context) (*values.Array, error)

func (*Manager) GetFrameTree

func (m *Manager) GetFrameTree(_ context.Context, frameID page.FrameID) (page.FrameTree, error)

func (*Manager) GetMainFrame

func (m *Manager) GetMainFrame() *HTMLDocument

func (*Manager) RemoveAttrModifiedListener

func (m *Manager) RemoveAttrModifiedListener(listenerID events.ListenerID)

func (*Manager) RemoveAttrRemovedListener

func (m *Manager) RemoveAttrRemovedListener(listenerID events.ListenerID)

func (*Manager) RemoveChildNodeCountUpdatedListener

func (m *Manager) RemoveChildNodeCountUpdatedListener(listenerID events.ListenerID)

func (*Manager) RemoveChildNodeInsertedListener

func (m *Manager) RemoveChildNodeInsertedListener(listenerID events.ListenerID)

func (*Manager) RemoveChildNodeRemovedListener

func (m *Manager) RemoveChildNodeRemovedListener(listenerID events.ListenerID)

func (*Manager) RemoveFrame

func (m *Manager) RemoveFrame(frameID page.FrameID) error

func (*Manager) RemoveFrameRecursively

func (m *Manager) RemoveFrameRecursively(frameID page.FrameID) error

func (*Manager) RemoveFramesByParentID

func (m *Manager) RemoveFramesByParentID(parentFrameID page.FrameID) error

func (*Manager) RemoveReloadListener

func (m *Manager) RemoveReloadListener(listenerID events.ListenerID)

func (*Manager) SetMainFrame

func (m *Manager) SetMainFrame(doc *HTMLDocument)

func (*Manager) WaitForDOMReady

func (m *Manager) WaitForDOMReady(ctx context.Context) error

Jump to

Keyboard shortcuts

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