Documentation ¶
Overview ¶
Package domsnapshot provides the Chrome Debugging Protocol commands, types, and events for the DOMSnapshot domain.
This domain facilitates obtaining document snapshots with DOM, layout, and style information.
Generated by the cdproto-gen command.
Index ¶
- Constants
- type ComputedStyle
- type DOMNode
- type DisableParams
- func (p *DisableParams) Do(ctxt context.Context, h cdp.Executor) (err error)
- func (v DisableParams) MarshalEasyJSON(w *jwriter.Writer)
- func (v DisableParams) MarshalJSON() ([]byte, error)
- func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *DisableParams) UnmarshalJSON(data []byte) error
- type EnableParams
- type GetSnapshotParams
- func (p *GetSnapshotParams) Do(ctxt context.Context, h cdp.Executor) (domNodes []*DOMNode, layoutTreeNodes []*LayoutTreeNode, ...)
- func (v GetSnapshotParams) MarshalEasyJSON(w *jwriter.Writer)
- func (v GetSnapshotParams) MarshalJSON() ([]byte, error)
- func (v *GetSnapshotParams) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *GetSnapshotParams) UnmarshalJSON(data []byte) error
- func (p GetSnapshotParams) WithIncludeEventListeners(includeEventListeners bool) *GetSnapshotParams
- func (p GetSnapshotParams) WithIncludePaintOrder(includePaintOrder bool) *GetSnapshotParams
- func (p GetSnapshotParams) WithIncludeUserAgentShadowTree(includeUserAgentShadowTree bool) *GetSnapshotParams
- type GetSnapshotReturns
- type InlineTextBox
- type LayoutTreeNode
- type NameValue
Constants ¶
const ( CommandDisable = "DOMSnapshot.disable" CommandEnable = "DOMSnapshot.enable" CommandGetSnapshot = "DOMSnapshot.getSnapshot" )
Command names.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ComputedStyle ¶
type ComputedStyle struct {
Properties []*NameValue `json:"properties"` // Name/value pairs of computed style properties.
}
ComputedStyle a subset of the full ComputedStyle as defined by the request whitelist.
func (ComputedStyle) MarshalEasyJSON ¶
func (v ComputedStyle) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ComputedStyle) MarshalJSON ¶
func (v ComputedStyle) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ComputedStyle) UnmarshalEasyJSON ¶
func (v *ComputedStyle) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ComputedStyle) UnmarshalJSON ¶
func (v *ComputedStyle) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type DOMNode ¶
type DOMNode struct { NodeType cdp.NodeType `json:"nodeType"` // Node's nodeType. NodeName string `json:"nodeName"` // Node's nodeName. NodeValue string `json:"nodeValue"` // Node's nodeValue. TextValue string `json:"textValue,omitempty"` // Only set for textarea elements, contains the text value. InputValue string `json:"inputValue,omitempty"` // Only set for input elements, contains the input's associated text value. InputChecked bool `json:"inputChecked,omitempty"` // Only set for radio and checkbox input elements, indicates if the element has been checked OptionSelected bool `json:"optionSelected,omitempty"` // Only set for option elements, indicates if the element has been selected BackendNodeID cdp.BackendNodeID `json:"backendNodeId"` // Node's id, corresponds to DOM.Node.backendNodeId. ChildNodeIndexes []int64 `json:"childNodeIndexes,omitempty"` // The indexes of the node's child nodes in the domNodes array returned by getSnapshot, if any. Attributes []*NameValue `json:"attributes,omitempty"` // Attributes of an Element node. PseudoElementIndexes []int64 `json:"pseudoElementIndexes,omitempty"` // Indexes of pseudo elements associated with this node in the domNodes array returned by getSnapshot, if any. LayoutNodeIndex int64 `json:"layoutNodeIndex,omitempty"` // The index of the node's related layout tree node in the layoutTreeNodes array returned by getSnapshot, if any. DocumentURL string `json:"documentURL,omitempty"` // Document URL that Document or FrameOwner node points to. BaseURL string `json:"baseURL,omitempty"` // Base URL that Document or FrameOwner node uses for URL completion. ContentLanguage string `json:"contentLanguage,omitempty"` // Only set for documents, contains the document's content language. DocumentEncoding string `json:"documentEncoding,omitempty"` // Only set for documents, contains the document's character set encoding. PublicID string `json:"publicId,omitempty"` // DocumentType node's publicId. SystemID string `json:"systemId,omitempty"` // DocumentType node's systemId. FrameID cdp.FrameID `json:"frameId,omitempty"` // Frame ID for frame owner elements and also for the document node. ContentDocumentIndex int64 `json:"contentDocumentIndex,omitempty"` // The index of a frame owner element's content document in the domNodes array returned by getSnapshot, if any. ImportedDocumentIndex int64 `json:"importedDocumentIndex,omitempty"` // Index of the imported document's node of a link element in the domNodes array returned by getSnapshot, if any. TemplateContentIndex int64 `json:"templateContentIndex,omitempty"` // Index of the content node of a template element in the domNodes array returned by getSnapshot. PseudoType cdp.PseudoType `json:"pseudoType,omitempty"` // Type of a pseudo element node. ShadowRootType cdp.ShadowRootType `json:"shadowRootType,omitempty"` // Shadow root type. IsClickable bool `json:"isClickable,omitempty"` // Whether this DOM node responds to mouse clicks. This includes nodes that have had click event listeners attached via JavaScript as well as anchor tags that naturally navigate when clicked. EventListeners []*domdebugger.EventListener `json:"eventListeners,omitempty"` // Details of the node's event listeners, if any. CurrentSourceURL string `json:"currentSourceURL,omitempty"` // The selected url for nodes with a srcset attribute. OriginURL string `json:"originURL,omitempty"` // The url of the script (if any) that generates this node. }
DOMNode a Node in the DOM tree.
func (DOMNode) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (DOMNode) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*DOMNode) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*DOMNode) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type DisableParams ¶
type DisableParams struct{}
DisableParams disables DOM snapshot agent for the given page.
func Disable ¶
func Disable() *DisableParams
Disable disables DOM snapshot agent for the given page.
func (DisableParams) MarshalEasyJSON ¶
func (v DisableParams) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (DisableParams) MarshalJSON ¶
func (v DisableParams) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*DisableParams) UnmarshalEasyJSON ¶
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*DisableParams) UnmarshalJSON ¶
func (v *DisableParams) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type EnableParams ¶
type EnableParams struct{}
EnableParams enables DOM snapshot agent for the given page.
func (EnableParams) MarshalEasyJSON ¶
func (v EnableParams) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (EnableParams) MarshalJSON ¶
func (v EnableParams) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*EnableParams) UnmarshalEasyJSON ¶
func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*EnableParams) UnmarshalJSON ¶
func (v *EnableParams) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type GetSnapshotParams ¶
type GetSnapshotParams struct { ComputedStyleWhitelist []string `json:"computedStyleWhitelist"` // Whitelist of computed styles to return. IncludeEventListeners bool `json:"includeEventListeners,omitempty"` // Whether or not to retrieve details of DOM listeners (default false). IncludePaintOrder bool `json:"includePaintOrder,omitempty"` // Whether to determine and include the paint order index of LayoutTreeNodes (default false). IncludeUserAgentShadowTree bool `json:"includeUserAgentShadowTree,omitempty"` // Whether to include UA shadow tree in the snapshot (default false). }
GetSnapshotParams returns a document snapshot, including the full DOM tree of the root node (including iframes, template contents, and imported documents) in a flattened array, as well as layout and white-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is flattened.
func GetSnapshot ¶
func GetSnapshot(computedStyleWhitelist []string) *GetSnapshotParams
GetSnapshot returns a document snapshot, including the full DOM tree of the root node (including iframes, template contents, and imported documents) in a flattened array, as well as layout and white-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is flattened.
parameters:
computedStyleWhitelist - Whitelist of computed styles to return.
func (*GetSnapshotParams) Do ¶
func (p *GetSnapshotParams) Do(ctxt context.Context, h cdp.Executor) (domNodes []*DOMNode, layoutTreeNodes []*LayoutTreeNode, computedStyles []*ComputedStyle, err error)
Do executes DOMSnapshot.getSnapshot against the provided context.
returns:
domNodes - The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document. layoutTreeNodes - The nodes in the layout tree. computedStyles - Whitelisted ComputedStyle properties for each node in the layout tree.
func (GetSnapshotParams) MarshalEasyJSON ¶
func (v GetSnapshotParams) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (GetSnapshotParams) MarshalJSON ¶
func (v GetSnapshotParams) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*GetSnapshotParams) UnmarshalEasyJSON ¶
func (v *GetSnapshotParams) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*GetSnapshotParams) UnmarshalJSON ¶
func (v *GetSnapshotParams) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
func (GetSnapshotParams) WithIncludeEventListeners ¶
func (p GetSnapshotParams) WithIncludeEventListeners(includeEventListeners bool) *GetSnapshotParams
WithIncludeEventListeners whether or not to retrieve details of DOM listeners (default false).
func (GetSnapshotParams) WithIncludePaintOrder ¶
func (p GetSnapshotParams) WithIncludePaintOrder(includePaintOrder bool) *GetSnapshotParams
WithIncludePaintOrder whether to determine and include the paint order index of LayoutTreeNodes (default false).
func (GetSnapshotParams) WithIncludeUserAgentShadowTree ¶
func (p GetSnapshotParams) WithIncludeUserAgentShadowTree(includeUserAgentShadowTree bool) *GetSnapshotParams
WithIncludeUserAgentShadowTree whether to include UA shadow tree in the snapshot (default false).
type GetSnapshotReturns ¶
type GetSnapshotReturns struct { DomNodes []*DOMNode `json:"domNodes,omitempty"` // The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document. LayoutTreeNodes []*LayoutTreeNode `json:"layoutTreeNodes,omitempty"` // The nodes in the layout tree. ComputedStyles []*ComputedStyle `json:"computedStyles,omitempty"` // Whitelisted ComputedStyle properties for each node in the layout tree. }
GetSnapshotReturns return values.
func (GetSnapshotReturns) MarshalEasyJSON ¶
func (v GetSnapshotReturns) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (GetSnapshotReturns) MarshalJSON ¶
func (v GetSnapshotReturns) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*GetSnapshotReturns) UnmarshalEasyJSON ¶
func (v *GetSnapshotReturns) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*GetSnapshotReturns) UnmarshalJSON ¶
func (v *GetSnapshotReturns) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type InlineTextBox ¶
type InlineTextBox struct { BoundingBox *dom.Rect `json:"boundingBox"` // The absolute position bounding box. StartCharacterIndex int64 `json:"startCharacterIndex"` // The starting index in characters, for this post layout textbox substring. Characters that would be represented as a surrogate pair in UTF-16 have length 2. NumCharacters int64 `json:"numCharacters"` // The number of characters in this post layout textbox substring. Characters that would be represented as a surrogate pair in UTF-16 have length 2. }
InlineTextBox details of post layout rendered text positions. The exact layout should not be regarded as stable and may change between versions.
func (InlineTextBox) MarshalEasyJSON ¶
func (v InlineTextBox) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (InlineTextBox) MarshalJSON ¶
func (v InlineTextBox) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*InlineTextBox) UnmarshalEasyJSON ¶
func (v *InlineTextBox) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*InlineTextBox) UnmarshalJSON ¶
func (v *InlineTextBox) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type LayoutTreeNode ¶
type LayoutTreeNode struct { DomNodeIndex int64 `json:"domNodeIndex"` // The index of the related DOM node in the domNodes array returned by getSnapshot. BoundingBox *dom.Rect `json:"boundingBox"` // The absolute position bounding box. LayoutText string `json:"layoutText,omitempty"` // Contents of the LayoutText, if any. InlineTextNodes []*InlineTextBox `json:"inlineTextNodes,omitempty"` // The post-layout inline text nodes, if any. StyleIndex int64 `json:"styleIndex,omitempty"` // Index into the computedStyles array returned by getSnapshot. PaintOrder int64 `json:"paintOrder,omitempty"` // Global paint order index, which is determined by the stacking order of the nodes. Nodes that are painted together will have the same index. Only provided if includePaintOrder in getSnapshot was true. }
LayoutTreeNode details of an element in the DOM tree with a LayoutObject.
func (LayoutTreeNode) MarshalEasyJSON ¶
func (v LayoutTreeNode) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (LayoutTreeNode) MarshalJSON ¶
func (v LayoutTreeNode) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*LayoutTreeNode) UnmarshalEasyJSON ¶
func (v *LayoutTreeNode) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*LayoutTreeNode) UnmarshalJSON ¶
func (v *LayoutTreeNode) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type NameValue ¶
type NameValue struct { Name string `json:"name"` // Attribute/property name. Value string `json:"value"` // Attribute/property value. }
NameValue a name/value pair.
func (NameValue) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (NameValue) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*NameValue) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*NameValue) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface