domsnapshot

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommandDOMSnapshotDisable         = "DOMSnapshot.disable"
	CommandDOMSnapshotEnable          = "DOMSnapshot.enable"
	CommandDOMSnapshotGetSnapshot     = "DOMSnapshot.getSnapshot"
	CommandDOMSnapshotCaptureSnapshot = "DOMSnapshot.captureSnapshot"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayOfStrings

type ArrayOfStrings []StringIndex

ArrayOfStrings Index of the string in the strings table.

type CaptureSnapshotArgs

type CaptureSnapshotArgs struct {
	ComputedStyles    []string `json:"computedStyles"`              // Whitelist of computed styles to return.
	IncludePaintOrder bool     `json:"includePaintOrder,omitempty"` // Whether to include layout object paint orders into the snapshot.
	IncludeDOMRects   bool     `json:"includeDOMRects,omitempty"`   // Whether to include DOM rectangles (offsetRects, clientRects, scrollRects) into the snapshot
}

CaptureSnapshotArgs represents the arguments for CaptureSnapshot in the DOMSnapshot domain.

func (*CaptureSnapshotArgs) MarshalJSON

func (a *CaptureSnapshotArgs) MarshalJSON() ([]byte, error)

Marshall the byte array into a return value for CaptureSnapshot in the DOMSnapshot domain.

func (*CaptureSnapshotArgs) UnmarshalJSON

func (a *CaptureSnapshotArgs) UnmarshalJSON(b []byte) error

Unmarshal the byte array into a return value for CaptureSnapshot in the DOMSnapshot domain.

type CaptureSnapshotReply

type CaptureSnapshotReply struct {
	Documents []DocumentSnapshot `json:"documents"` // The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document.
	Strings   []string           `json:"strings"`   // Shared string table that all string properties refer to with indexes.
}

CaptureSnapshotReply represents the return values for CaptureSnapshot in the DOMSnapshot domain.

func (*CaptureSnapshotReply) GetFrameID

func (a *CaptureSnapshotReply) GetFrameID() string

CaptureSnapshotReply returns the FrameID value for CaptureSnapshot in the DOMSnapshot domain.

func (*CaptureSnapshotReply) MatchFrameID

func (a *CaptureSnapshotReply) MatchFrameID(frameID string, m []byte) (bool, error)

CaptureSnapshotReply returns whether or not the FrameID matches the reply value for CaptureSnapshot in the DOMSnapshot domain.

func (*CaptureSnapshotReply) UnmarshalJSON

func (a *CaptureSnapshotReply) UnmarshalJSON(b []byte) error

Unmarshal the byte array into a return value for CaptureSnapshot in the DOMSnapshot domain.

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.

type DOMNode

type DOMNode struct {
	NodeType             int                          `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        dom.BackendNodeID            `json:"backendNodeId"`                  // `Node`'s id, corresponds to DOM.Node.backendNodeId.
	ChildNodeIndexes     *[]int                       `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 *[]int                       `json:"pseudoElementIndexes,omitempty"` // Indexes of pseudo elements associated with this node in the `domNodes` array returned by `getSnapshot`, if any.
	LayoutNodeIndex      int                          `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              shared.FrameID               `json:"frameId,omitempty"`              // Frame ID for frame owner elements and also for the document node.
	ContentDocumentIndex int                          `json:"contentDocumentIndex,omitempty"` // The index of a frame owner element's content document in the `domNodes` array returned by `getSnapshot`, if any.
	PseudoType           *dom.PseudoType              `json:"pseudoType,omitempty"`           // Type of a pseudo element node.
	ShadowRootType       *dom.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.
	ScrollOffsetX        float64                      `json:"scrollOffsetX,omitempty"`        // Scroll offsets, set when this node is a Document.
	ScrollOffsetY        float64                      `json:"scrollOffsetY,omitempty"`        // No description.
}

DOMNode A Node in the DOM tree.

type DisableArgs

type DisableArgs struct {
}

DisableArgs represents the arguments for Disable in the DOMSnapshot domain.

func (*DisableArgs) MarshalJSON

func (a *DisableArgs) MarshalJSON() ([]byte, error)

Marshall the byte array into a return value for Disable in the DOMSnapshot domain.

func (*DisableArgs) UnmarshalJSON

func (a *DisableArgs) UnmarshalJSON(b []byte) error

Unmarshal the byte array into a return value for Disable in the DOMSnapshot domain.

type DisableReply

type DisableReply struct {
}

DisableReply represents the return values for Disable in the DOMSnapshot domain.

func (*DisableReply) GetFrameID

func (a *DisableReply) GetFrameID() string

DisableReply returns the FrameID value for Disable in the DOMSnapshot domain.

func (*DisableReply) MatchFrameID

func (a *DisableReply) MatchFrameID(frameID string, m []byte) (bool, error)

DisableReply returns whether or not the FrameID matches the reply value for Disable in the DOMSnapshot domain.

func (*DisableReply) UnmarshalJSON

func (a *DisableReply) UnmarshalJSON(b []byte) error

Unmarshal the byte array into a return value for Disable in the DOMSnapshot domain.

type DocumentSnapshot

type DocumentSnapshot struct {
	DocumentURL     StringIndex        `json:"documentURL"`             // Document URL that `Document` or `FrameOwner` node points to.
	Title           StringIndex        `json:"title"`                   // Document title.
	BaseURL         StringIndex        `json:"baseURL"`                 // Base URL that `Document` or `FrameOwner` node uses for URL completion.
	ContentLanguage StringIndex        `json:"contentLanguage"`         // Contains the document's content language.
	EncodingName    StringIndex        `json:"encodingName"`            // Contains the document's character set encoding.
	PublicID        StringIndex        `json:"publicId"`                // `DocumentType` node's publicId.
	SystemID        StringIndex        `json:"systemId"`                // `DocumentType` node's systemId.
	FrameID         StringIndex        `json:"frameId"`                 // Frame ID for frame owner elements and also for the document node.
	Nodes           NodeTreeSnapshot   `json:"nodes"`                   // A table with dom nodes.
	Layout          LayoutTreeSnapshot `json:"layout"`                  // The nodes in the layout tree.
	TextBoxes       TextBoxSnapshot    `json:"textBoxes"`               // The post-layout inline text nodes.
	ScrollOffsetX   float64            `json:"scrollOffsetX,omitempty"` // Horizontal scroll offset.
	ScrollOffsetY   float64            `json:"scrollOffsetY,omitempty"` // Vertical scroll offset.
	ContentWidth    float64            `json:"contentWidth,omitempty"`  // Document content width.
	ContentHeight   float64            `json:"contentHeight,omitempty"` // Document content height.
}

DocumentSnapshot Document snapshot.

type EnableArgs

type EnableArgs struct {
}

EnableArgs represents the arguments for Enable in the DOMSnapshot domain.

func (*EnableArgs) MarshalJSON

func (a *EnableArgs) MarshalJSON() ([]byte, error)

Marshall the byte array into a return value for Enable in the DOMSnapshot domain.

func (*EnableArgs) UnmarshalJSON

func (a *EnableArgs) UnmarshalJSON(b []byte) error

Unmarshal the byte array into a return value for Enable in the DOMSnapshot domain.

type EnableReply

type EnableReply struct {
}

EnableReply represents the return values for Enable in the DOMSnapshot domain.

func (*EnableReply) GetFrameID

func (a *EnableReply) GetFrameID() string

EnableReply returns the FrameID value for Enable in the DOMSnapshot domain.

func (*EnableReply) MatchFrameID

func (a *EnableReply) MatchFrameID(frameID string, m []byte) (bool, error)

EnableReply returns whether or not the FrameID matches the reply value for Enable in the DOMSnapshot domain.

func (*EnableReply) UnmarshalJSON

func (a *EnableReply) UnmarshalJSON(b []byte) error

Unmarshal the byte array into a return value for Enable in the DOMSnapshot domain.

type GetSnapshotArgs

type GetSnapshotArgs 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).
}

GetSnapshotArgs represents the arguments for GetSnapshot in the DOMSnapshot domain.

func (*GetSnapshotArgs) MarshalJSON

func (a *GetSnapshotArgs) MarshalJSON() ([]byte, error)

Marshall the byte array into a return value for GetSnapshot in the DOMSnapshot domain.

func (*GetSnapshotArgs) UnmarshalJSON

func (a *GetSnapshotArgs) UnmarshalJSON(b []byte) error

Unmarshal the byte array into a return value for GetSnapshot in the DOMSnapshot domain.

type GetSnapshotReply

type GetSnapshotReply struct {
	DOMNodes        []DOMNode        `json:"domNodes"`        // The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document.
	LayoutTreeNodes []LayoutTreeNode `json:"layoutTreeNodes"` // The nodes in the layout tree.
	ComputedStyles  []ComputedStyle  `json:"computedStyles"`  // Whitelisted ComputedStyle properties for each node in the layout tree.
}

GetSnapshotReply represents the return values for GetSnapshot in the DOMSnapshot domain.

func (*GetSnapshotReply) GetFrameID

func (a *GetSnapshotReply) GetFrameID() string

GetSnapshotReply returns the FrameID value for GetSnapshot in the DOMSnapshot domain.

func (*GetSnapshotReply) MatchFrameID

func (a *GetSnapshotReply) MatchFrameID(frameID string, m []byte) (bool, error)

GetSnapshotReply returns whether or not the FrameID matches the reply value for GetSnapshot in the DOMSnapshot domain.

func (*GetSnapshotReply) UnmarshalJSON

func (a *GetSnapshotReply) UnmarshalJSON(b []byte) error

Unmarshal the byte array into a return value for GetSnapshot in the DOMSnapshot domain.

type InlineTextBox

type InlineTextBox struct {
	BoundingBox         dom.Rect `json:"boundingBox"`         // The bounding box in document coordinates. Note that scroll offset of the document is ignored.
	StartCharacterIndex int      `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       int      `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.

type LayoutTreeNode

type LayoutTreeNode struct {
	DOMNodeIndex      int              `json:"domNodeIndex"`                // The index of the related DOM node in the `domNodes` array returned by `getSnapshot`.
	BoundingBox       dom.Rect         `json:"boundingBox"`                 // The bounding box in document coordinates. Note that scroll offset of the document is ignored.
	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        int              `json:"styleIndex,omitempty"`        // Index into the `computedStyles` array returned by `getSnapshot`.
	PaintOrder        int              `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.
	IsStackingContext bool             `json:"isStackingContext,omitempty"` // Set to true to indicate the element begins a new stacking context.
}

LayoutTreeNode Details of an element in the DOM tree with a LayoutObject.

type LayoutTreeSnapshot

type LayoutTreeSnapshot struct {
	NodeIndex        []int            `json:"nodeIndex"`             // Index of the corresponding node in the `NodeTreeSnapshot` array returned by `captureSnapshot`.
	Styles           []ArrayOfStrings `json:"styles"`                // Array of indexes specifying computed style strings, filtered according to the `computedStyles` parameter passed to `captureSnapshot`.
	Bounds           []Rectangle      `json:"bounds"`                // The absolute position bounding box.
	Text             []StringIndex    `json:"text"`                  // Contents of the LayoutText, if any.
	StackingContexts RareBooleanData  `json:"stackingContexts"`      // Stacking context information.
	PaintOrders      *[]int           `json:"paintOrders,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 captureSnapshot was true.
	OffsetRects      *[]Rectangle     `json:"offsetRects,omitempty"` // The offset rect of nodes. Only available when includeDOMRects is set to true
	ScrollRects      *[]Rectangle     `json:"scrollRects,omitempty"` // The scroll rect of nodes. Only available when includeDOMRects is set to true
	ClientRects      *[]Rectangle     `json:"clientRects,omitempty"` // The client rect of nodes. Only available when includeDOMRects is set to true
}

LayoutTreeSnapshot Table of details of an element in the DOM tree with a LayoutObject.

type NameValue

type NameValue struct {
	Name  string `json:"name"`  // Attribute/property name.
	Value string `json:"value"` // Attribute/property value.
}

NameValue A name/value pair.

type NodeTreeSnapshot

type NodeTreeSnapshot struct {
	ParentIndex          *[]int               `json:"parentIndex,omitempty"`          // Parent node index.
	NodeType             *[]int               `json:"nodeType,omitempty"`             // `Node`'s nodeType.
	NodeName             *[]StringIndex       `json:"nodeName,omitempty"`             // `Node`'s nodeName.
	NodeValue            *[]StringIndex       `json:"nodeValue,omitempty"`            // `Node`'s nodeValue.
	BackendNodeID        *[]dom.BackendNodeID `json:"backendNodeId,omitempty"`        // `Node`'s id, corresponds to DOM.Node.backendNodeId.
	Attributes           *[]ArrayOfStrings    `json:"attributes,omitempty"`           // Attributes of an `Element` node. Flatten name, value pairs.
	TextValue            *RareStringData      `json:"textValue,omitempty"`            // Only set for textarea elements, contains the text value.
	InputValue           *RareStringData      `json:"inputValue,omitempty"`           // Only set for input elements, contains the input's associated text value.
	InputChecked         *RareBooleanData     `json:"inputChecked,omitempty"`         // Only set for radio and checkbox input elements, indicates if the element has been checked
	OptionSelected       *RareBooleanData     `json:"optionSelected,omitempty"`       // Only set for option elements, indicates if the element has been selected
	ContentDocumentIndex *RareIntegerData     `json:"contentDocumentIndex,omitempty"` // The index of the document in the list of the snapshot documents.
	PseudoType           *RareStringData      `json:"pseudoType,omitempty"`           // Type of a pseudo element node.
	IsClickable          *RareBooleanData     `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.
	CurrentSourceURL     *RareStringData      `json:"currentSourceURL,omitempty"`     // The selected url for nodes with a srcset attribute.
	OriginURL            *RareStringData      `json:"originURL,omitempty"`            // The url of the script (if any) that generates this node.
}

NodeTreeSnapshot Table containing nodes.

type RareBooleanData

type RareBooleanData struct {
	Index []int `json:"index"` // No description.
}

RareBooleanData

type RareIntegerData

type RareIntegerData struct {
	Index []int `json:"index"` // No description.
	Value []int `json:"value"` // No description.
}

RareIntegerData

type RareStringData

type RareStringData struct {
	Index []int         `json:"index"` // No description.
	Value []StringIndex `json:"value"` // No description.
}

RareStringData Data that is only present on rare nodes.

type Rectangle

type Rectangle []float64

Rectangle

type StringIndex

type StringIndex int

StringIndex Index of the string in the strings table.

type TextBoxSnapshot

type TextBoxSnapshot struct {
	LayoutIndex []int       `json:"layoutIndex"` // Index of the layout tree node that owns this box collection.
	Bounds      []Rectangle `json:"bounds"`      // The absolute position bounding box.
	Start       []int       `json:"start"`       // 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.
	Length      []int       `json:"length"`      // 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.
}

TextBoxSnapshot Table of details of the post layout rendered text positions. The exact layout should not be regarded as stable and may change between versions.

Jump to

Keyboard shortcuts

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