Add cdp support for xpath scrapers (#625)

Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
bnkai
2020-08-04 03:42:40 +03:00
committed by GitHub
parent 1b4a9eed36
commit 4373f9bf01
284 changed files with 133250 additions and 54 deletions

2435
vendor/github.com/chromedp/cdproto/overlay/easyjson.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

38
vendor/github.com/chromedp/cdproto/overlay/events.go generated vendored Normal file
View File

@@ -0,0 +1,38 @@
package overlay
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"github.com/chromedp/cdproto/cdp"
"github.com/chromedp/cdproto/page"
)
// EventInspectNodeRequested fired when the node should be inspected. This
// happens after call to setInspectMode or when user manually inspects an
// element.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#event-inspectNodeRequested
type EventInspectNodeRequested struct {
BackendNodeID cdp.BackendNodeID `json:"backendNodeId"` // Id of the node to inspect.
}
// EventNodeHighlightRequested fired when the node should be highlighted.
// This happens after call to setInspectMode.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#event-nodeHighlightRequested
type EventNodeHighlightRequested struct {
NodeID cdp.NodeID `json:"nodeId"`
}
// EventScreenshotRequested fired when user asks to capture screenshot of
// some area on the page.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#event-screenshotRequested
type EventScreenshotRequested struct {
Viewport *page.Viewport `json:"viewport"` // Viewport to capture, in device independent pixels (dip).
}
// EventInspectModeCanceled fired when user cancels the inspect mode.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#event-inspectModeCanceled
type EventInspectModeCanceled struct{}

591
vendor/github.com/chromedp/cdproto/overlay/overlay.go generated vendored Normal file
View File

@@ -0,0 +1,591 @@
// Package overlay provides the Chrome DevTools Protocol
// commands, types, and events for the Overlay domain.
//
// This domain provides various functionality related to drawing atop the
// inspected page.
//
// Generated by the cdproto-gen command.
package overlay
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"context"
"github.com/chromedp/cdproto/cdp"
"github.com/chromedp/cdproto/dom"
"github.com/chromedp/cdproto/runtime"
"github.com/mailru/easyjson"
)
// DisableParams disables domain notifications.
type DisableParams struct{}
// Disable disables domain notifications.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-disable
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes Overlay.disable against the provided context.
func (p *DisableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandDisable, nil, nil)
}
// EnableParams enables domain notifications.
type EnableParams struct{}
// Enable enables domain notifications.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-enable
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes Overlay.enable against the provided context.
func (p *EnableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandEnable, nil, nil)
}
// GetHighlightObjectForTestParams for testing.
type GetHighlightObjectForTestParams struct {
NodeID cdp.NodeID `json:"nodeId"` // Id of the node to get highlight object for.
IncludeDistance bool `json:"includeDistance,omitempty"` // Whether to include distance info.
IncludeStyle bool `json:"includeStyle,omitempty"` // Whether to include style info.
ColorFormat ColorFormat `json:"colorFormat,omitempty"` // The color format to get config with (default: hex)
}
// GetHighlightObjectForTest for testing.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-getHighlightObjectForTest
//
// parameters:
// nodeID - Id of the node to get highlight object for.
func GetHighlightObjectForTest(nodeID cdp.NodeID) *GetHighlightObjectForTestParams {
return &GetHighlightObjectForTestParams{
NodeID: nodeID,
}
}
// WithIncludeDistance whether to include distance info.
func (p GetHighlightObjectForTestParams) WithIncludeDistance(includeDistance bool) *GetHighlightObjectForTestParams {
p.IncludeDistance = includeDistance
return &p
}
// WithIncludeStyle whether to include style info.
func (p GetHighlightObjectForTestParams) WithIncludeStyle(includeStyle bool) *GetHighlightObjectForTestParams {
p.IncludeStyle = includeStyle
return &p
}
// WithColorFormat the color format to get config with (default: hex).
func (p GetHighlightObjectForTestParams) WithColorFormat(colorFormat ColorFormat) *GetHighlightObjectForTestParams {
p.ColorFormat = colorFormat
return &p
}
// GetHighlightObjectForTestReturns return values.
type GetHighlightObjectForTestReturns struct {
Highlight easyjson.RawMessage `json:"highlight,omitempty"`
}
// Do executes Overlay.getHighlightObjectForTest against the provided context.
//
// returns:
// highlight - Highlight data for the node.
func (p *GetHighlightObjectForTestParams) Do(ctx context.Context) (highlight easyjson.RawMessage, err error) {
// execute
var res GetHighlightObjectForTestReturns
err = cdp.Execute(ctx, CommandGetHighlightObjectForTest, p, &res)
if err != nil {
return nil, err
}
return res.Highlight, nil
}
// HideHighlightParams hides any highlight.
type HideHighlightParams struct{}
// HideHighlight hides any highlight.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-hideHighlight
func HideHighlight() *HideHighlightParams {
return &HideHighlightParams{}
}
// Do executes Overlay.hideHighlight against the provided context.
func (p *HideHighlightParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandHideHighlight, nil, nil)
}
// HighlightFrameParams highlights owner element of the frame with given id.
type HighlightFrameParams struct {
FrameID cdp.FrameID `json:"frameId"` // Identifier of the frame to highlight.
ContentColor *cdp.RGBA `json:"contentColor,omitempty"` // The content box highlight fill color (default: transparent).
ContentOutlineColor *cdp.RGBA `json:"contentOutlineColor,omitempty"` // The content box highlight outline color (default: transparent).
}
// HighlightFrame highlights owner element of the frame with given id.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-highlightFrame
//
// parameters:
// frameID - Identifier of the frame to highlight.
func HighlightFrame(frameID cdp.FrameID) *HighlightFrameParams {
return &HighlightFrameParams{
FrameID: frameID,
}
}
// WithContentColor the content box highlight fill color (default:
// transparent).
func (p HighlightFrameParams) WithContentColor(contentColor *cdp.RGBA) *HighlightFrameParams {
p.ContentColor = contentColor
return &p
}
// WithContentOutlineColor the content box highlight outline color (default:
// transparent).
func (p HighlightFrameParams) WithContentOutlineColor(contentOutlineColor *cdp.RGBA) *HighlightFrameParams {
p.ContentOutlineColor = contentOutlineColor
return &p
}
// Do executes Overlay.highlightFrame against the provided context.
func (p *HighlightFrameParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandHighlightFrame, p, nil)
}
// HighlightNodeParams highlights DOM node with given id or with the given
// JavaScript object wrapper. Either nodeId or objectId must be specified.
type HighlightNodeParams struct {
HighlightConfig *HighlightConfig `json:"highlightConfig"` // A descriptor for the highlight appearance.
NodeID cdp.NodeID `json:"nodeId,omitempty"` // Identifier of the node to highlight.
BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty"` // Identifier of the backend node to highlight.
ObjectID runtime.RemoteObjectID `json:"objectId,omitempty"` // JavaScript object id of the node to be highlighted.
Selector string `json:"selector,omitempty"` // Selectors to highlight relevant nodes.
}
// HighlightNode highlights DOM node with given id or with the given
// JavaScript object wrapper. Either nodeId or objectId must be specified.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-highlightNode
//
// parameters:
// highlightConfig - A descriptor for the highlight appearance.
func HighlightNode(highlightConfig *HighlightConfig) *HighlightNodeParams {
return &HighlightNodeParams{
HighlightConfig: highlightConfig,
}
}
// WithNodeID identifier of the node to highlight.
func (p HighlightNodeParams) WithNodeID(nodeID cdp.NodeID) *HighlightNodeParams {
p.NodeID = nodeID
return &p
}
// WithBackendNodeID identifier of the backend node to highlight.
func (p HighlightNodeParams) WithBackendNodeID(backendNodeID cdp.BackendNodeID) *HighlightNodeParams {
p.BackendNodeID = backendNodeID
return &p
}
// WithObjectID JavaScript object id of the node to be highlighted.
func (p HighlightNodeParams) WithObjectID(objectID runtime.RemoteObjectID) *HighlightNodeParams {
p.ObjectID = objectID
return &p
}
// WithSelector selectors to highlight relevant nodes.
func (p HighlightNodeParams) WithSelector(selector string) *HighlightNodeParams {
p.Selector = selector
return &p
}
// Do executes Overlay.highlightNode against the provided context.
func (p *HighlightNodeParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandHighlightNode, p, nil)
}
// HighlightQuadParams highlights given quad. Coordinates are absolute with
// respect to the main frame viewport.
type HighlightQuadParams struct {
Quad dom.Quad `json:"quad"` // Quad to highlight
Color *cdp.RGBA `json:"color,omitempty"` // The highlight fill color (default: transparent).
OutlineColor *cdp.RGBA `json:"outlineColor,omitempty"` // The highlight outline color (default: transparent).
}
// HighlightQuad highlights given quad. Coordinates are absolute with respect
// to the main frame viewport.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-highlightQuad
//
// parameters:
// quad - Quad to highlight
func HighlightQuad(quad dom.Quad) *HighlightQuadParams {
return &HighlightQuadParams{
Quad: quad,
}
}
// WithColor the highlight fill color (default: transparent).
func (p HighlightQuadParams) WithColor(color *cdp.RGBA) *HighlightQuadParams {
p.Color = color
return &p
}
// WithOutlineColor the highlight outline color (default: transparent).
func (p HighlightQuadParams) WithOutlineColor(outlineColor *cdp.RGBA) *HighlightQuadParams {
p.OutlineColor = outlineColor
return &p
}
// Do executes Overlay.highlightQuad against the provided context.
func (p *HighlightQuadParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandHighlightQuad, p, nil)
}
// HighlightRectParams highlights given rectangle. Coordinates are absolute
// with respect to the main frame viewport.
type HighlightRectParams struct {
X int64 `json:"x"` // X coordinate
Y int64 `json:"y"` // Y coordinate
Width int64 `json:"width"` // Rectangle width
Height int64 `json:"height"` // Rectangle height
Color *cdp.RGBA `json:"color,omitempty"` // The highlight fill color (default: transparent).
OutlineColor *cdp.RGBA `json:"outlineColor,omitempty"` // The highlight outline color (default: transparent).
}
// HighlightRect highlights given rectangle. Coordinates are absolute with
// respect to the main frame viewport.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-highlightRect
//
// parameters:
// x - X coordinate
// y - Y coordinate
// width - Rectangle width
// height - Rectangle height
func HighlightRect(x int64, y int64, width int64, height int64) *HighlightRectParams {
return &HighlightRectParams{
X: x,
Y: y,
Width: width,
Height: height,
}
}
// WithColor the highlight fill color (default: transparent).
func (p HighlightRectParams) WithColor(color *cdp.RGBA) *HighlightRectParams {
p.Color = color
return &p
}
// WithOutlineColor the highlight outline color (default: transparent).
func (p HighlightRectParams) WithOutlineColor(outlineColor *cdp.RGBA) *HighlightRectParams {
p.OutlineColor = outlineColor
return &p
}
// Do executes Overlay.highlightRect against the provided context.
func (p *HighlightRectParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandHighlightRect, p, nil)
}
// SetInspectModeParams enters the 'inspect' mode. In this mode, elements
// that user is hovering over are highlighted. Backend then generates
// 'inspectNodeRequested' event upon element selection.
type SetInspectModeParams struct {
Mode InspectMode `json:"mode"` // Set an inspection mode.
HighlightConfig *HighlightConfig `json:"highlightConfig,omitempty"` // A descriptor for the highlight appearance of hovered-over nodes. May be omitted if enabled == false.
}
// SetInspectMode enters the 'inspect' mode. In this mode, elements that user
// is hovering over are highlighted. Backend then generates
// 'inspectNodeRequested' event upon element selection.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-setInspectMode
//
// parameters:
// mode - Set an inspection mode.
func SetInspectMode(mode InspectMode) *SetInspectModeParams {
return &SetInspectModeParams{
Mode: mode,
}
}
// WithHighlightConfig a descriptor for the highlight appearance of
// hovered-over nodes. May be omitted if enabled == false.
func (p SetInspectModeParams) WithHighlightConfig(highlightConfig *HighlightConfig) *SetInspectModeParams {
p.HighlightConfig = highlightConfig
return &p
}
// Do executes Overlay.setInspectMode against the provided context.
func (p *SetInspectModeParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetInspectMode, p, nil)
}
// SetShowAdHighlightsParams highlights owner element of all frames detected
// to be ads.
type SetShowAdHighlightsParams struct {
Show bool `json:"show"` // True for showing ad highlights
}
// SetShowAdHighlights highlights owner element of all frames detected to be
// ads.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-setShowAdHighlights
//
// parameters:
// show - True for showing ad highlights
func SetShowAdHighlights(show bool) *SetShowAdHighlightsParams {
return &SetShowAdHighlightsParams{
Show: show,
}
}
// Do executes Overlay.setShowAdHighlights against the provided context.
func (p *SetShowAdHighlightsParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetShowAdHighlights, p, nil)
}
// SetPausedInDebuggerMessageParams [no description].
type SetPausedInDebuggerMessageParams struct {
Message string `json:"message,omitempty"` // The message to display, also triggers resume and step over controls.
}
// SetPausedInDebuggerMessage [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-setPausedInDebuggerMessage
//
// parameters:
func SetPausedInDebuggerMessage() *SetPausedInDebuggerMessageParams {
return &SetPausedInDebuggerMessageParams{}
}
// WithMessage the message to display, also triggers resume and step over
// controls.
func (p SetPausedInDebuggerMessageParams) WithMessage(message string) *SetPausedInDebuggerMessageParams {
p.Message = message
return &p
}
// Do executes Overlay.setPausedInDebuggerMessage against the provided context.
func (p *SetPausedInDebuggerMessageParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetPausedInDebuggerMessage, p, nil)
}
// SetShowDebugBordersParams requests that backend shows debug borders on
// layers.
type SetShowDebugBordersParams struct {
Show bool `json:"show"` // True for showing debug borders
}
// SetShowDebugBorders requests that backend shows debug borders on layers.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-setShowDebugBorders
//
// parameters:
// show - True for showing debug borders
func SetShowDebugBorders(show bool) *SetShowDebugBordersParams {
return &SetShowDebugBordersParams{
Show: show,
}
}
// Do executes Overlay.setShowDebugBorders against the provided context.
func (p *SetShowDebugBordersParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetShowDebugBorders, p, nil)
}
// SetShowFPSCounterParams requests that backend shows the FPS counter.
type SetShowFPSCounterParams struct {
Show bool `json:"show"` // True for showing the FPS counter
}
// SetShowFPSCounter requests that backend shows the FPS counter.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-setShowFPSCounter
//
// parameters:
// show - True for showing the FPS counter
func SetShowFPSCounter(show bool) *SetShowFPSCounterParams {
return &SetShowFPSCounterParams{
Show: show,
}
}
// Do executes Overlay.setShowFPSCounter against the provided context.
func (p *SetShowFPSCounterParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetShowFPSCounter, p, nil)
}
// SetShowPaintRectsParams requests that backend shows paint rectangles.
type SetShowPaintRectsParams struct {
Result bool `json:"result"` // True for showing paint rectangles
}
// SetShowPaintRects requests that backend shows paint rectangles.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-setShowPaintRects
//
// parameters:
// result - True for showing paint rectangles
func SetShowPaintRects(result bool) *SetShowPaintRectsParams {
return &SetShowPaintRectsParams{
Result: result,
}
}
// Do executes Overlay.setShowPaintRects against the provided context.
func (p *SetShowPaintRectsParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetShowPaintRects, p, nil)
}
// SetShowLayoutShiftRegionsParams requests that backend shows layout shift
// regions.
type SetShowLayoutShiftRegionsParams struct {
Result bool `json:"result"` // True for showing layout shift regions
}
// SetShowLayoutShiftRegions requests that backend shows layout shift
// regions.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-setShowLayoutShiftRegions
//
// parameters:
// result - True for showing layout shift regions
func SetShowLayoutShiftRegions(result bool) *SetShowLayoutShiftRegionsParams {
return &SetShowLayoutShiftRegionsParams{
Result: result,
}
}
// Do executes Overlay.setShowLayoutShiftRegions against the provided context.
func (p *SetShowLayoutShiftRegionsParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetShowLayoutShiftRegions, p, nil)
}
// SetShowScrollBottleneckRectsParams requests that backend shows scroll
// bottleneck rects.
type SetShowScrollBottleneckRectsParams struct {
Show bool `json:"show"` // True for showing scroll bottleneck rects
}
// SetShowScrollBottleneckRects requests that backend shows scroll bottleneck
// rects.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-setShowScrollBottleneckRects
//
// parameters:
// show - True for showing scroll bottleneck rects
func SetShowScrollBottleneckRects(show bool) *SetShowScrollBottleneckRectsParams {
return &SetShowScrollBottleneckRectsParams{
Show: show,
}
}
// Do executes Overlay.setShowScrollBottleneckRects against the provided context.
func (p *SetShowScrollBottleneckRectsParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetShowScrollBottleneckRects, p, nil)
}
// SetShowHitTestBordersParams requests that backend shows hit-test borders
// on layers.
type SetShowHitTestBordersParams struct {
Show bool `json:"show"` // True for showing hit-test borders
}
// SetShowHitTestBorders requests that backend shows hit-test borders on
// layers.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-setShowHitTestBorders
//
// parameters:
// show - True for showing hit-test borders
func SetShowHitTestBorders(show bool) *SetShowHitTestBordersParams {
return &SetShowHitTestBordersParams{
Show: show,
}
}
// Do executes Overlay.setShowHitTestBorders against the provided context.
func (p *SetShowHitTestBordersParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetShowHitTestBorders, p, nil)
}
// SetShowViewportSizeOnResizeParams paints viewport size upon main frame
// resize.
type SetShowViewportSizeOnResizeParams struct {
Show bool `json:"show"` // Whether to paint size or not.
}
// SetShowViewportSizeOnResize paints viewport size upon main frame resize.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-setShowViewportSizeOnResize
//
// parameters:
// show - Whether to paint size or not.
func SetShowViewportSizeOnResize(show bool) *SetShowViewportSizeOnResizeParams {
return &SetShowViewportSizeOnResizeParams{
Show: show,
}
}
// Do executes Overlay.setShowViewportSizeOnResize against the provided context.
func (p *SetShowViewportSizeOnResizeParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetShowViewportSizeOnResize, p, nil)
}
// SetShowHingeParams add a dual screen device hinge.
type SetShowHingeParams struct {
HingeConfig *HingeConfig `json:"hingeConfig,omitempty"` // hinge data, null means hideHinge
}
// SetShowHinge add a dual screen device hinge.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-setShowHinge
//
// parameters:
func SetShowHinge() *SetShowHingeParams {
return &SetShowHingeParams{}
}
// WithHingeConfig hinge data, null means hideHinge.
func (p SetShowHingeParams) WithHingeConfig(hingeConfig *HingeConfig) *SetShowHingeParams {
p.HingeConfig = hingeConfig
return &p
}
// Do executes Overlay.setShowHinge against the provided context.
func (p *SetShowHingeParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetShowHinge, p, nil)
}
// Command names.
const (
CommandDisable = "Overlay.disable"
CommandEnable = "Overlay.enable"
CommandGetHighlightObjectForTest = "Overlay.getHighlightObjectForTest"
CommandHideHighlight = "Overlay.hideHighlight"
CommandHighlightFrame = "Overlay.highlightFrame"
CommandHighlightNode = "Overlay.highlightNode"
CommandHighlightQuad = "Overlay.highlightQuad"
CommandHighlightRect = "Overlay.highlightRect"
CommandSetInspectMode = "Overlay.setInspectMode"
CommandSetShowAdHighlights = "Overlay.setShowAdHighlights"
CommandSetPausedInDebuggerMessage = "Overlay.setPausedInDebuggerMessage"
CommandSetShowDebugBorders = "Overlay.setShowDebugBorders"
CommandSetShowFPSCounter = "Overlay.setShowFPSCounter"
CommandSetShowPaintRects = "Overlay.setShowPaintRects"
CommandSetShowLayoutShiftRegions = "Overlay.setShowLayoutShiftRegions"
CommandSetShowScrollBottleneckRects = "Overlay.setShowScrollBottleneckRects"
CommandSetShowHitTestBorders = "Overlay.setShowHitTestBorders"
CommandSetShowViewportSizeOnResize = "Overlay.setShowViewportSizeOnResize"
CommandSetShowHinge = "Overlay.setShowHinge"
)

158
vendor/github.com/chromedp/cdproto/overlay/types.go generated vendored Normal file
View File

@@ -0,0 +1,158 @@
package overlay
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"errors"
"github.com/chromedp/cdproto/cdp"
"github.com/chromedp/cdproto/dom"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// GridHighlightConfig configuration data for the highlighting of Grid
// elements.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#type-GridHighlightConfig
type GridHighlightConfig struct {
ShowGridExtensionLines bool `json:"showGridExtensionLines,omitempty"` // Whether the extension lines from grid cells to the rulers should be shown (default: false).
GridBorderColor *cdp.RGBA `json:"gridBorderColor,omitempty"` // The grid container border highlight color (default: transparent).
CellBorderColor *cdp.RGBA `json:"cellBorderColor,omitempty"` // The cell border color (default: transparent).
GridBorderDash bool `json:"gridBorderDash,omitempty"` // Whether the grid border is dashed (default: false).
CellBorderDash bool `json:"cellBorderDash,omitempty"` // Whether the cell border is dashed (default: false).
RowGapColor *cdp.RGBA `json:"rowGapColor,omitempty"` // The row gap highlight fill color (default: transparent).
RowHatchColor *cdp.RGBA `json:"rowHatchColor,omitempty"` // The row gap hatching fill color (default: transparent).
ColumnGapColor *cdp.RGBA `json:"columnGapColor,omitempty"` // The column gap highlight fill color (default: transparent).
ColumnHatchColor *cdp.RGBA `json:"columnHatchColor,omitempty"` // The column gap hatching fill color (default: transparent).
}
// HighlightConfig configuration data for the highlighting of page elements.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#type-HighlightConfig
type HighlightConfig struct {
ShowInfo bool `json:"showInfo,omitempty"` // Whether the node info tooltip should be shown (default: false).
ShowStyles bool `json:"showStyles,omitempty"` // Whether the node styles in the tooltip (default: false).
ShowRulers bool `json:"showRulers,omitempty"` // Whether the rulers should be shown (default: false).
ShowExtensionLines bool `json:"showExtensionLines,omitempty"` // Whether the extension lines from node to the rulers should be shown (default: false).
ContentColor *cdp.RGBA `json:"contentColor,omitempty"` // The content box highlight fill color (default: transparent).
PaddingColor *cdp.RGBA `json:"paddingColor,omitempty"` // The padding highlight fill color (default: transparent).
BorderColor *cdp.RGBA `json:"borderColor,omitempty"` // The border highlight fill color (default: transparent).
MarginColor *cdp.RGBA `json:"marginColor,omitempty"` // The margin highlight fill color (default: transparent).
EventTargetColor *cdp.RGBA `json:"eventTargetColor,omitempty"` // The event target element highlight fill color (default: transparent).
ShapeColor *cdp.RGBA `json:"shapeColor,omitempty"` // The shape outside fill color (default: transparent).
ShapeMarginColor *cdp.RGBA `json:"shapeMarginColor,omitempty"` // The shape margin fill color (default: transparent).
CSSGridColor *cdp.RGBA `json:"cssGridColor,omitempty"` // The grid layout color (default: transparent).
ColorFormat ColorFormat `json:"colorFormat,omitempty"` // The color format used to format color styles (default: hex).
GridHighlightConfig *GridHighlightConfig `json:"gridHighlightConfig,omitempty"` // The grid layout highlight configuration (default: all transparent).
}
// ColorFormat [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#type-ColorFormat
type ColorFormat string
// String returns the ColorFormat as string value.
func (t ColorFormat) String() string {
return string(t)
}
// ColorFormat values.
const (
ColorFormatRgb ColorFormat = "rgb"
ColorFormatHsl ColorFormat = "hsl"
ColorFormatHex ColorFormat = "hex"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t ColorFormat) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t ColorFormat) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *ColorFormat) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch ColorFormat(in.String()) {
case ColorFormatRgb:
*t = ColorFormatRgb
case ColorFormatHsl:
*t = ColorFormatHsl
case ColorFormatHex:
*t = ColorFormatHex
default:
in.AddError(errors.New("unknown ColorFormat value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *ColorFormat) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// HingeConfig configuration for dual screen hinge.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#type-HingeConfig
type HingeConfig struct {
Rect *dom.Rect `json:"rect"` // A rectangle represent hinge
ContentColor *cdp.RGBA `json:"contentColor,omitempty"` // The content box highlight fill color (default: a dark color).
OutlineColor *cdp.RGBA `json:"outlineColor,omitempty"` // The content box highlight outline color (default: transparent).
}
// InspectMode [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#type-InspectMode
type InspectMode string
// String returns the InspectMode as string value.
func (t InspectMode) String() string {
return string(t)
}
// InspectMode values.
const (
InspectModeSearchForNode InspectMode = "searchForNode"
InspectModeSearchForUAShadowDOM InspectMode = "searchForUAShadowDOM"
InspectModeCaptureAreaScreenshot InspectMode = "captureAreaScreenshot"
InspectModeShowDistances InspectMode = "showDistances"
InspectModeNone InspectMode = "none"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t InspectMode) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t InspectMode) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *InspectMode) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch InspectMode(in.String()) {
case InspectModeSearchForNode:
*t = InspectModeSearchForNode
case InspectModeSearchForUAShadowDOM:
*t = InspectModeSearchForUAShadowDOM
case InspectModeCaptureAreaScreenshot:
*t = InspectModeCaptureAreaScreenshot
case InspectModeShowDistances:
*t = InspectModeShowDistances
case InspectModeNone:
*t = InspectModeNone
default:
in.AddError(errors.New("unknown InspectMode value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *InspectMode) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}