Source File
domsnapshot.go
Belonging Package
github.com/chromedp/cdproto/domsnapshot
// Package domsnapshot provides the Chrome DevTools 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.package domsnapshot// Code generated by cdproto-gen. DO NOT EDIT.import ()// DisableParams disables DOM snapshot agent for the given page.type DisableParams struct{}// Disable disables DOM snapshot agent for the given page.//// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMSnapshot#method-disablefunc () *DisableParams {return &DisableParams{}}// Do executes DOMSnapshot.disable against the provided context.func ( *DisableParams) ( context.Context) ( error) {return cdp.Execute(, CommandDisable, nil, nil)}// EnableParams enables DOM snapshot agent for the given page.type EnableParams struct{}// Enable enables DOM snapshot agent for the given page.//// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMSnapshot#method-enablefunc () *EnableParams {return &EnableParams{}}// Do executes DOMSnapshot.enable against the provided context.func ( *EnableParams) ( context.Context) ( error) {return cdp.Execute(, CommandEnable, nil, nil)}// CaptureSnapshotParams 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.type CaptureSnapshotParams 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 snapshotIncludeBlendedBackgroundColors bool `json:"includeBlendedBackgroundColors,omitempty"` // Whether to include blended background colors in the snapshot (default: false). Blended background color is achieved by blending background colors of all elements that overlap with the current element.IncludeTextColorOpacities bool `json:"includeTextColorOpacities,omitempty"` // Whether to include text color opacity in the snapshot (default: false). An element might have the opacity property set that affects the text color of the element. The final text color opacity is computed based on the opacity of all overlapping elements.}// CaptureSnapshot 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.//// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMSnapshot#method-captureSnapshot//// parameters://// computedStyles - Whitelist of computed styles to return.func ( []string) *CaptureSnapshotParams {return &CaptureSnapshotParams{ComputedStyles: ,}}// WithIncludePaintOrder whether to include layout object paint orders into// the snapshot.func ( CaptureSnapshotParams) ( bool) *CaptureSnapshotParams {.IncludePaintOrder =return &}// WithIncludeDOMRects whether to include DOM rectangles (offsetRects,// clientRects, scrollRects) into the snapshot.func ( CaptureSnapshotParams) ( bool) *CaptureSnapshotParams {.IncludeDOMRects =return &}// WithIncludeBlendedBackgroundColors whether to include blended background// colors in the snapshot (default: false). Blended background color is achieved// by blending background colors of all elements that overlap with the current// element.func ( CaptureSnapshotParams) ( bool) *CaptureSnapshotParams {.IncludeBlendedBackgroundColors =return &}// WithIncludeTextColorOpacities whether to include text color opacity in the// snapshot (default: false). An element might have the opacity property set// that affects the text color of the element. The final text color opacity is// computed based on the opacity of all overlapping elements.func ( CaptureSnapshotParams) ( bool) *CaptureSnapshotParams {.IncludeTextColorOpacities =return &}// CaptureSnapshotReturns return values.type CaptureSnapshotReturns struct {Documents []*DocumentSnapshot `json:"documents,omitempty"` // The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document.Strings []string `json:"strings,omitempty"` // Shared string table that all string properties refer to with indexes.}// Do executes DOMSnapshot.captureSnapshot against the provided context.//// returns://// documents - The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document.// strings - Shared string table that all string properties refer to with indexes.func ( *CaptureSnapshotParams) ( context.Context) ( []*DocumentSnapshot, []string, error) {// executevar CaptureSnapshotReturns= cdp.Execute(, CommandCaptureSnapshot, , &)if != nil {return nil, nil,}return .Documents, .Strings, nil}// Command names.const (CommandDisable = "DOMSnapshot.disable"CommandEnable = "DOMSnapshot.enable"CommandCaptureSnapshot = "DOMSnapshot.captureSnapshot")
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |