Adding script to generate domains from protocol.json and updating to latest protocol.json

This commit is contained in:
Kenneth Shaw 2017-05-06 08:20:24 +07:00
parent 6598ce143e
commit 869aafc836
59 changed files with 3541 additions and 3214 deletions

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package accessibility package accessibility

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package animation package animation

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package applicationcache package applicationcache

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package browser package browser

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package cachestorage package cachestorage

View File

@ -93,17 +93,29 @@ const (
CommandPageStopScreencast MethodType = "Page.stopScreencast" CommandPageStopScreencast MethodType = "Page.stopScreencast"
CommandPageScreencastFrameAck MethodType = "Page.screencastFrameAck" CommandPageScreencastFrameAck MethodType = "Page.screencastFrameAck"
CommandPageHandleJavaScriptDialog MethodType = "Page.handleJavaScriptDialog" CommandPageHandleJavaScriptDialog MethodType = "Page.handleJavaScriptDialog"
CommandPageConfigureOverlay MethodType = "Page.configureOverlay"
CommandPageGetAppManifest MethodType = "Page.getAppManifest" CommandPageGetAppManifest MethodType = "Page.getAppManifest"
CommandPageRequestAppBanner MethodType = "Page.requestAppBanner" CommandPageRequestAppBanner MethodType = "Page.requestAppBanner"
CommandPageSetControlNavigations MethodType = "Page.setControlNavigations" CommandPageSetControlNavigations MethodType = "Page.setControlNavigations"
CommandPageProcessNavigation MethodType = "Page.processNavigation" CommandPageProcessNavigation MethodType = "Page.processNavigation"
CommandPageGetLayoutMetrics MethodType = "Page.getLayoutMetrics" CommandPageGetLayoutMetrics MethodType = "Page.getLayoutMetrics"
CommandRenderingSetShowPaintRects MethodType = "Rendering.setShowPaintRects" EventOverlayNodeHighlightRequested MethodType = "Overlay.nodeHighlightRequested"
CommandRenderingSetShowDebugBorders MethodType = "Rendering.setShowDebugBorders" EventOverlayInspectNodeRequested MethodType = "Overlay.inspectNodeRequested"
CommandRenderingSetShowFPSCounter MethodType = "Rendering.setShowFPSCounter" CommandOverlayEnable MethodType = "Overlay.enable"
CommandRenderingSetShowScrollBottleneckRects MethodType = "Rendering.setShowScrollBottleneckRects" CommandOverlayDisable MethodType = "Overlay.disable"
CommandRenderingSetShowViewportSizeOnResize MethodType = "Rendering.setShowViewportSizeOnResize" CommandOverlaySetShowPaintRects MethodType = "Overlay.setShowPaintRects"
CommandOverlaySetShowDebugBorders MethodType = "Overlay.setShowDebugBorders"
CommandOverlaySetShowFPSCounter MethodType = "Overlay.setShowFPSCounter"
CommandOverlaySetShowScrollBottleneckRects MethodType = "Overlay.setShowScrollBottleneckRects"
CommandOverlaySetShowViewportSizeOnResize MethodType = "Overlay.setShowViewportSizeOnResize"
CommandOverlaySetPausedInDebuggerMessage MethodType = "Overlay.setPausedInDebuggerMessage"
CommandOverlaySetSuspended MethodType = "Overlay.setSuspended"
CommandOverlaySetInspectMode MethodType = "Overlay.setInspectMode"
CommandOverlayHighlightRect MethodType = "Overlay.highlightRect"
CommandOverlayHighlightQuad MethodType = "Overlay.highlightQuad"
CommandOverlayHighlightNode MethodType = "Overlay.highlightNode"
CommandOverlayHighlightFrame MethodType = "Overlay.highlightFrame"
CommandOverlayHideHighlight MethodType = "Overlay.hideHighlight"
CommandOverlayGetHighlightObjectForTest MethodType = "Overlay.getHighlightObjectForTest"
EventEmulationVirtualTimeBudgetExpired MethodType = "Emulation.virtualTimeBudgetExpired" EventEmulationVirtualTimeBudgetExpired MethodType = "Emulation.virtualTimeBudgetExpired"
CommandEmulationSetDeviceMetricsOverride MethodType = "Emulation.setDeviceMetricsOverride" CommandEmulationSetDeviceMetricsOverride MethodType = "Emulation.setDeviceMetricsOverride"
CommandEmulationClearDeviceMetricsOverride MethodType = "Emulation.clearDeviceMetricsOverride" CommandEmulationClearDeviceMetricsOverride MethodType = "Emulation.clearDeviceMetricsOverride"
@ -197,7 +209,6 @@ const (
CommandApplicationCacheGetManifestForFrame MethodType = "ApplicationCache.getManifestForFrame" CommandApplicationCacheGetManifestForFrame MethodType = "ApplicationCache.getManifestForFrame"
CommandApplicationCacheGetApplicationCacheForFrame MethodType = "ApplicationCache.getApplicationCacheForFrame" CommandApplicationCacheGetApplicationCacheForFrame MethodType = "ApplicationCache.getApplicationCacheForFrame"
EventDOMDocumentUpdated MethodType = "DOM.documentUpdated" EventDOMDocumentUpdated MethodType = "DOM.documentUpdated"
EventDOMInspectNodeRequested MethodType = "DOM.inspectNodeRequested"
EventDOMSetChildNodes MethodType = "DOM.setChildNodes" EventDOMSetChildNodes MethodType = "DOM.setChildNodes"
EventDOMAttributeModified MethodType = "DOM.attributeModified" EventDOMAttributeModified MethodType = "DOM.attributeModified"
EventDOMAttributeRemoved MethodType = "DOM.attributeRemoved" EventDOMAttributeRemoved MethodType = "DOM.attributeRemoved"
@ -211,7 +222,6 @@ const (
EventDOMPseudoElementAdded MethodType = "DOM.pseudoElementAdded" EventDOMPseudoElementAdded MethodType = "DOM.pseudoElementAdded"
EventDOMPseudoElementRemoved MethodType = "DOM.pseudoElementRemoved" EventDOMPseudoElementRemoved MethodType = "DOM.pseudoElementRemoved"
EventDOMDistributedNodesUpdated MethodType = "DOM.distributedNodesUpdated" EventDOMDistributedNodesUpdated MethodType = "DOM.distributedNodesUpdated"
EventDOMNodeHighlightRequested MethodType = "DOM.nodeHighlightRequested"
CommandDOMEnable MethodType = "DOM.enable" CommandDOMEnable MethodType = "DOM.enable"
CommandDOMDisable MethodType = "DOM.disable" CommandDOMDisable MethodType = "DOM.disable"
CommandDOMGetDocument MethodType = "DOM.getDocument" CommandDOMGetDocument MethodType = "DOM.getDocument"
@ -232,12 +242,6 @@ const (
CommandDOMGetSearchResults MethodType = "DOM.getSearchResults" CommandDOMGetSearchResults MethodType = "DOM.getSearchResults"
CommandDOMDiscardSearchResults MethodType = "DOM.discardSearchResults" CommandDOMDiscardSearchResults MethodType = "DOM.discardSearchResults"
CommandDOMRequestNode MethodType = "DOM.requestNode" CommandDOMRequestNode MethodType = "DOM.requestNode"
CommandDOMSetInspectMode MethodType = "DOM.setInspectMode"
CommandDOMHighlightRect MethodType = "DOM.highlightRect"
CommandDOMHighlightQuad MethodType = "DOM.highlightQuad"
CommandDOMHighlightNode MethodType = "DOM.highlightNode"
CommandDOMHideHighlight MethodType = "DOM.hideHighlight"
CommandDOMHighlightFrame MethodType = "DOM.highlightFrame"
CommandDOMPushNodeByPathToFrontend MethodType = "DOM.pushNodeByPathToFrontend" CommandDOMPushNodeByPathToFrontend MethodType = "DOM.pushNodeByPathToFrontend"
CommandDOMPushNodesByBackendIdsToFrontend MethodType = "DOM.pushNodesByBackendIdsToFrontend" CommandDOMPushNodesByBackendIdsToFrontend MethodType = "DOM.pushNodesByBackendIdsToFrontend"
CommandDOMSetInspectedNode MethodType = "DOM.setInspectedNode" CommandDOMSetInspectedNode MethodType = "DOM.setInspectedNode"
@ -253,7 +257,6 @@ const (
CommandDOMGetBoxModel MethodType = "DOM.getBoxModel" CommandDOMGetBoxModel MethodType = "DOM.getBoxModel"
CommandDOMGetNodeForLocation MethodType = "DOM.getNodeForLocation" CommandDOMGetNodeForLocation MethodType = "DOM.getNodeForLocation"
CommandDOMGetRelayoutBoundary MethodType = "DOM.getRelayoutBoundary" CommandDOMGetRelayoutBoundary MethodType = "DOM.getRelayoutBoundary"
CommandDOMGetHighlightObjectForTest MethodType = "DOM.getHighlightObjectForTest"
EventCSSMediaQueryResultChanged MethodType = "CSS.mediaQueryResultChanged" EventCSSMediaQueryResultChanged MethodType = "CSS.mediaQueryResultChanged"
EventCSSFontsUpdated MethodType = "CSS.fontsUpdated" EventCSSFontsUpdated MethodType = "CSS.fontsUpdated"
EventCSSStyleSheetChanged MethodType = "CSS.styleSheetChanged" EventCSSStyleSheetChanged MethodType = "CSS.styleSheetChanged"
@ -563,8 +566,6 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = CommandPageScreencastFrameAck *t = CommandPageScreencastFrameAck
case CommandPageHandleJavaScriptDialog: case CommandPageHandleJavaScriptDialog:
*t = CommandPageHandleJavaScriptDialog *t = CommandPageHandleJavaScriptDialog
case CommandPageConfigureOverlay:
*t = CommandPageConfigureOverlay
case CommandPageGetAppManifest: case CommandPageGetAppManifest:
*t = CommandPageGetAppManifest *t = CommandPageGetAppManifest
case CommandPageRequestAppBanner: case CommandPageRequestAppBanner:
@ -575,16 +576,42 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = CommandPageProcessNavigation *t = CommandPageProcessNavigation
case CommandPageGetLayoutMetrics: case CommandPageGetLayoutMetrics:
*t = CommandPageGetLayoutMetrics *t = CommandPageGetLayoutMetrics
case CommandRenderingSetShowPaintRects: case EventOverlayNodeHighlightRequested:
*t = CommandRenderingSetShowPaintRects *t = EventOverlayNodeHighlightRequested
case CommandRenderingSetShowDebugBorders: case EventOverlayInspectNodeRequested:
*t = CommandRenderingSetShowDebugBorders *t = EventOverlayInspectNodeRequested
case CommandRenderingSetShowFPSCounter: case CommandOverlayEnable:
*t = CommandRenderingSetShowFPSCounter *t = CommandOverlayEnable
case CommandRenderingSetShowScrollBottleneckRects: case CommandOverlayDisable:
*t = CommandRenderingSetShowScrollBottleneckRects *t = CommandOverlayDisable
case CommandRenderingSetShowViewportSizeOnResize: case CommandOverlaySetShowPaintRects:
*t = CommandRenderingSetShowViewportSizeOnResize *t = CommandOverlaySetShowPaintRects
case CommandOverlaySetShowDebugBorders:
*t = CommandOverlaySetShowDebugBorders
case CommandOverlaySetShowFPSCounter:
*t = CommandOverlaySetShowFPSCounter
case CommandOverlaySetShowScrollBottleneckRects:
*t = CommandOverlaySetShowScrollBottleneckRects
case CommandOverlaySetShowViewportSizeOnResize:
*t = CommandOverlaySetShowViewportSizeOnResize
case CommandOverlaySetPausedInDebuggerMessage:
*t = CommandOverlaySetPausedInDebuggerMessage
case CommandOverlaySetSuspended:
*t = CommandOverlaySetSuspended
case CommandOverlaySetInspectMode:
*t = CommandOverlaySetInspectMode
case CommandOverlayHighlightRect:
*t = CommandOverlayHighlightRect
case CommandOverlayHighlightQuad:
*t = CommandOverlayHighlightQuad
case CommandOverlayHighlightNode:
*t = CommandOverlayHighlightNode
case CommandOverlayHighlightFrame:
*t = CommandOverlayHighlightFrame
case CommandOverlayHideHighlight:
*t = CommandOverlayHideHighlight
case CommandOverlayGetHighlightObjectForTest:
*t = CommandOverlayGetHighlightObjectForTest
case EventEmulationVirtualTimeBudgetExpired: case EventEmulationVirtualTimeBudgetExpired:
*t = EventEmulationVirtualTimeBudgetExpired *t = EventEmulationVirtualTimeBudgetExpired
case CommandEmulationSetDeviceMetricsOverride: case CommandEmulationSetDeviceMetricsOverride:
@ -771,8 +798,6 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = CommandApplicationCacheGetApplicationCacheForFrame *t = CommandApplicationCacheGetApplicationCacheForFrame
case EventDOMDocumentUpdated: case EventDOMDocumentUpdated:
*t = EventDOMDocumentUpdated *t = EventDOMDocumentUpdated
case EventDOMInspectNodeRequested:
*t = EventDOMInspectNodeRequested
case EventDOMSetChildNodes: case EventDOMSetChildNodes:
*t = EventDOMSetChildNodes *t = EventDOMSetChildNodes
case EventDOMAttributeModified: case EventDOMAttributeModified:
@ -799,8 +824,6 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = EventDOMPseudoElementRemoved *t = EventDOMPseudoElementRemoved
case EventDOMDistributedNodesUpdated: case EventDOMDistributedNodesUpdated:
*t = EventDOMDistributedNodesUpdated *t = EventDOMDistributedNodesUpdated
case EventDOMNodeHighlightRequested:
*t = EventDOMNodeHighlightRequested
case CommandDOMEnable: case CommandDOMEnable:
*t = CommandDOMEnable *t = CommandDOMEnable
case CommandDOMDisable: case CommandDOMDisable:
@ -841,18 +864,6 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = CommandDOMDiscardSearchResults *t = CommandDOMDiscardSearchResults
case CommandDOMRequestNode: case CommandDOMRequestNode:
*t = CommandDOMRequestNode *t = CommandDOMRequestNode
case CommandDOMSetInspectMode:
*t = CommandDOMSetInspectMode
case CommandDOMHighlightRect:
*t = CommandDOMHighlightRect
case CommandDOMHighlightQuad:
*t = CommandDOMHighlightQuad
case CommandDOMHighlightNode:
*t = CommandDOMHighlightNode
case CommandDOMHideHighlight:
*t = CommandDOMHideHighlight
case CommandDOMHighlightFrame:
*t = CommandDOMHighlightFrame
case CommandDOMPushNodeByPathToFrontend: case CommandDOMPushNodeByPathToFrontend:
*t = CommandDOMPushNodeByPathToFrontend *t = CommandDOMPushNodeByPathToFrontend
case CommandDOMPushNodesByBackendIdsToFrontend: case CommandDOMPushNodesByBackendIdsToFrontend:
@ -883,8 +894,6 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = CommandDOMGetNodeForLocation *t = CommandDOMGetNodeForLocation
case CommandDOMGetRelayoutBoundary: case CommandDOMGetRelayoutBoundary:
*t = CommandDOMGetRelayoutBoundary *t = CommandDOMGetRelayoutBoundary
case CommandDOMGetHighlightObjectForTest:
*t = CommandDOMGetHighlightObjectForTest
case EventCSSMediaQueryResultChanged: case EventCSSMediaQueryResultChanged:
*t = EventCSSMediaQueryResultChanged *t = EventCSSMediaQueryResultChanged
case EventCSSFontsUpdated: case EventCSSFontsUpdated:

View File

@ -26,6 +26,7 @@ import (
logdom "github.com/knq/chromedp/cdp/log" logdom "github.com/knq/chromedp/cdp/log"
"github.com/knq/chromedp/cdp/memory" "github.com/knq/chromedp/cdp/memory"
"github.com/knq/chromedp/cdp/network" "github.com/knq/chromedp/cdp/network"
"github.com/knq/chromedp/cdp/overlay"
"github.com/knq/chromedp/cdp/page" "github.com/knq/chromedp/cdp/page"
"github.com/knq/chromedp/cdp/profiler" "github.com/knq/chromedp/cdp/profiler"
"github.com/knq/chromedp/cdp/runtime" "github.com/knq/chromedp/cdp/runtime"
@ -128,9 +129,6 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.CommandPageHandleJavaScriptDialog: case cdp.CommandPageHandleJavaScriptDialog:
return emptyVal, nil return emptyVal, nil
case cdp.CommandPageConfigureOverlay:
return emptyVal, nil
case cdp.CommandPageGetAppManifest: case cdp.CommandPageGetAppManifest:
v = new(page.GetAppManifestReturns) v = new(page.GetAppManifestReturns)
@ -197,21 +195,60 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.EventPageNavigationRequested: case cdp.EventPageNavigationRequested:
v = new(page.EventNavigationRequested) v = new(page.EventNavigationRequested)
case cdp.CommandRenderingSetShowPaintRects: case cdp.CommandOverlayEnable:
return emptyVal, nil return emptyVal, nil
case cdp.CommandRenderingSetShowDebugBorders: case cdp.CommandOverlayDisable:
return emptyVal, nil return emptyVal, nil
case cdp.CommandRenderingSetShowFPSCounter: case cdp.CommandOverlaySetShowPaintRects:
return emptyVal, nil return emptyVal, nil
case cdp.CommandRenderingSetShowScrollBottleneckRects: case cdp.CommandOverlaySetShowDebugBorders:
return emptyVal, nil return emptyVal, nil
case cdp.CommandRenderingSetShowViewportSizeOnResize: case cdp.CommandOverlaySetShowFPSCounter:
return emptyVal, nil return emptyVal, nil
case cdp.CommandOverlaySetShowScrollBottleneckRects:
return emptyVal, nil
case cdp.CommandOverlaySetShowViewportSizeOnResize:
return emptyVal, nil
case cdp.CommandOverlaySetPausedInDebuggerMessage:
return emptyVal, nil
case cdp.CommandOverlaySetSuspended:
return emptyVal, nil
case cdp.CommandOverlaySetInspectMode:
return emptyVal, nil
case cdp.CommandOverlayHighlightRect:
return emptyVal, nil
case cdp.CommandOverlayHighlightQuad:
return emptyVal, nil
case cdp.CommandOverlayHighlightNode:
return emptyVal, nil
case cdp.CommandOverlayHighlightFrame:
return emptyVal, nil
case cdp.CommandOverlayHideHighlight:
return emptyVal, nil
case cdp.CommandOverlayGetHighlightObjectForTest:
v = new(overlay.GetHighlightObjectForTestReturns)
case cdp.EventOverlayNodeHighlightRequested:
v = new(overlay.EventNodeHighlightRequested)
case cdp.EventOverlayInspectNodeRequested:
v = new(overlay.EventInspectNodeRequested)
case cdp.CommandEmulationSetDeviceMetricsOverride: case cdp.CommandEmulationSetDeviceMetricsOverride:
return emptyVal, nil return emptyVal, nil
@ -548,24 +585,6 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.CommandDOMRequestNode: case cdp.CommandDOMRequestNode:
v = new(dom.RequestNodeReturns) v = new(dom.RequestNodeReturns)
case cdp.CommandDOMSetInspectMode:
return emptyVal, nil
case cdp.CommandDOMHighlightRect:
return emptyVal, nil
case cdp.CommandDOMHighlightQuad:
return emptyVal, nil
case cdp.CommandDOMHighlightNode:
return emptyVal, nil
case cdp.CommandDOMHideHighlight:
return emptyVal, nil
case cdp.CommandDOMHighlightFrame:
return emptyVal, nil
case cdp.CommandDOMPushNodeByPathToFrontend: case cdp.CommandDOMPushNodeByPathToFrontend:
v = new(dom.PushNodeByPathToFrontendReturns) v = new(dom.PushNodeByPathToFrontendReturns)
@ -611,15 +630,9 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.CommandDOMGetRelayoutBoundary: case cdp.CommandDOMGetRelayoutBoundary:
v = new(dom.GetRelayoutBoundaryReturns) v = new(dom.GetRelayoutBoundaryReturns)
case cdp.CommandDOMGetHighlightObjectForTest:
v = new(dom.GetHighlightObjectForTestReturns)
case cdp.EventDOMDocumentUpdated: case cdp.EventDOMDocumentUpdated:
v = new(dom.EventDocumentUpdated) v = new(dom.EventDocumentUpdated)
case cdp.EventDOMInspectNodeRequested:
v = new(dom.EventInspectNodeRequested)
case cdp.EventDOMSetChildNodes: case cdp.EventDOMSetChildNodes:
v = new(dom.EventSetChildNodes) v = new(dom.EventSetChildNodes)
@ -659,9 +672,6 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.EventDOMDistributedNodesUpdated: case cdp.EventDOMDistributedNodesUpdated:
v = new(dom.EventDistributedNodesUpdated) v = new(dom.EventDistributedNodesUpdated)
case cdp.EventDOMNodeHighlightRequested:
v = new(dom.EventNodeHighlightRequested)
case cdp.CommandCSSEnable: case cdp.CommandCSSEnable:
return emptyVal, nil return emptyVal, nil

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package css package css

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package database package database

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package debugger package debugger

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package deviceorientation package deviceorientation

View File

@ -21,7 +21,6 @@ import (
cdp "github.com/knq/chromedp/cdp" cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/runtime" "github.com/knq/chromedp/cdp/runtime"
"github.com/mailru/easyjson"
) )
// EnableParams enables DOM agent for the given page. // EnableParams enables DOM agent for the given page.
@ -705,217 +704,6 @@ func (p *RequestNodeParams) Do(ctxt context.Context, h cdp.Handler) (nodeID cdp.
return res.NodeID, nil return res.NodeID, 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.
//
// 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 DOM.setInspectMode against the provided context and
// target handler.
func (p *SetInspectModeParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDOMSetInspectMode, 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.
//
// 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 DOM.highlightRect against the provided context and
// target handler.
func (p *HighlightRectParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDOMHighlightRect, p, nil)
}
// HighlightQuadParams highlights given quad. Coordinates are absolute with
// respect to the main frame viewport.
type HighlightQuadParams struct {
Quad 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.
//
// parameters:
// quad - Quad to highlight
func HighlightQuad(quad 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 DOM.highlightQuad against the provided context and
// target handler.
func (p *HighlightQuadParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDOMHighlightQuad, 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.
}
// HighlightNode highlights DOM node with given id or with the given
// JavaScript object wrapper. Either nodeId or objectId must be specified.
//
// 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
}
// Do executes DOM.highlightNode against the provided context and
// target handler.
func (p *HighlightNodeParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDOMHighlightNode, p, nil)
}
// HideHighlightParams hides DOM node highlight.
type HideHighlightParams struct{}
// HideHighlight hides DOM node highlight.
func HideHighlight() *HideHighlightParams {
return &HideHighlightParams{}
}
// Do executes DOM.hideHighlight against the provided context and
// target handler.
func (p *HideHighlightParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDOMHideHighlight, 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.
//
// 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 DOM.highlightFrame against the provided context and
// target handler.
func (p *HighlightFrameParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDOMHighlightFrame, p, nil)
}
// PushNodeByPathToFrontendParams requests that the node is sent to the // PushNodeByPathToFrontendParams requests that the node is sent to the
// caller given its path. // FIXME, use XPath. // caller given its path. // FIXME, use XPath.
type PushNodeByPathToFrontendParams struct { type PushNodeByPathToFrontendParams struct {
@ -1400,39 +1188,3 @@ func (p *GetRelayoutBoundaryParams) Do(ctxt context.Context, h cdp.Handler) (nod
return res.NodeID, nil return res.NodeID, nil
} }
// GetHighlightObjectForTestParams for testing.
type GetHighlightObjectForTestParams struct {
NodeID cdp.NodeID `json:"nodeId"` // Id of the node to get highlight object for.
}
// GetHighlightObjectForTest for testing.
//
// parameters:
// nodeID - Id of the node to get highlight object for.
func GetHighlightObjectForTest(nodeID cdp.NodeID) *GetHighlightObjectForTestParams {
return &GetHighlightObjectForTestParams{
NodeID: nodeID,
}
}
// GetHighlightObjectForTestReturns return values.
type GetHighlightObjectForTestReturns struct {
Highlight easyjson.RawMessage `json:"highlight,omitempty"`
}
// Do executes DOM.getHighlightObjectForTest against the provided context and
// target handler.
//
// returns:
// highlight - Highlight data for the node.
func (p *GetHighlightObjectForTestParams) Do(ctxt context.Context, h cdp.Handler) (highlight easyjson.RawMessage, err error) {
// execute
var res GetHighlightObjectForTestReturns
err = h.Execute(ctxt, cdp.CommandDOMGetHighlightObjectForTest, p, &res)
if err != nil {
return nil, err
}
return res.Highlight, nil
}

File diff suppressed because it is too large Load Diff

View File

@ -10,12 +10,6 @@ import (
// ids are no longer valid. // ids are no longer valid.
type EventDocumentUpdated struct{} type EventDocumentUpdated struct{}
// EventInspectNodeRequested fired when the node should be inspected. This
// happens after call to setInspectMode.
type EventInspectNodeRequested struct {
BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty"` // Id of the node to inspect.
}
// EventSetChildNodes fired when backend wants to provide client with the // EventSetChildNodes fired when backend wants to provide client with the
// missing DOM structure. This happens upon most of the calls requesting node // missing DOM structure. This happens upon most of the calls requesting node
// ids. // ids.
@ -101,15 +95,9 @@ type EventDistributedNodesUpdated struct {
DistributedNodes []*cdp.BackendNode `json:"distributedNodes,omitempty"` // Distributed nodes for given insertion point. DistributedNodes []*cdp.BackendNode `json:"distributedNodes,omitempty"` // Distributed nodes for given insertion point.
} }
// EventNodeHighlightRequested [no description].
type EventNodeHighlightRequested struct {
NodeID cdp.NodeID `json:"nodeId,omitempty"`
}
// EventTypes all event types in the domain. // EventTypes all event types in the domain.
var EventTypes = []cdp.MethodType{ var EventTypes = []cdp.MethodType{
cdp.EventDOMDocumentUpdated, cdp.EventDOMDocumentUpdated,
cdp.EventDOMInspectNodeRequested,
cdp.EventDOMSetChildNodes, cdp.EventDOMSetChildNodes,
cdp.EventDOMAttributeModified, cdp.EventDOMAttributeModified,
cdp.EventDOMAttributeRemoved, cdp.EventDOMAttributeRemoved,
@ -123,5 +111,4 @@ var EventTypes = []cdp.MethodType{
cdp.EventDOMPseudoElementAdded, cdp.EventDOMPseudoElementAdded,
cdp.EventDOMPseudoElementRemoved, cdp.EventDOMPseudoElementRemoved,
cdp.EventDOMDistributedNodesUpdated, cdp.EventDOMDistributedNodesUpdated,
cdp.EventDOMNodeHighlightRequested,
} }

View File

@ -1,16 +1,9 @@
package dom package dom
import "github.com/mailru/easyjson"
// AUTOGENERATED. DO NOT EDIT. // AUTOGENERATED. DO NOT EDIT.
import (
"errors"
cdp "github.com/knq/chromedp/cdp"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// Quad an array of quad vertices, x immediately followed by y for each // Quad an array of quad vertices, x immediately followed by y for each
// point, points clock-wise. // point, points clock-wise.
type Quad []float64 type Quad []float64
@ -40,64 +33,3 @@ type Rect struct {
Width float64 `json:"width,omitempty"` // Rectangle width Width float64 `json:"width,omitempty"` // Rectangle width
Height float64 `json:"height,omitempty"` // Rectangle height Height float64 `json:"height,omitempty"` // Rectangle height
} }
// HighlightConfig configuration data for the highlighting of page elements.
type HighlightConfig struct {
ShowInfo bool `json:"showInfo,omitempty"` // Whether the node info tooltip should be shown (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).
DisplayAsMaterial bool `json:"displayAsMaterial,omitempty"`
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).
SelectorList string `json:"selectorList,omitempty"` // Selectors to highlight relevant nodes.
}
// InspectMode [no description].
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"
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 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)
}

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package domdebugger package domdebugger

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package domstorage package domstorage

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package cdp package cdp

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package emulation package emulation

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package heapprofiler package heapprofiler

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package indexeddb package indexeddb

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package input package input

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package inspector package inspector

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package io package io

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package layertree package layertree

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package log package log

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package memory package memory

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package network package network

1794
cdp/overlay/easyjson.go Normal file

File diff suppressed because it is too large Load Diff

26
cdp/overlay/events.go Normal file
View File

@ -0,0 +1,26 @@
package overlay
// AUTOGENERATED. DO NOT EDIT.
import (
cdp "github.com/knq/chromedp/cdp"
)
// EventNodeHighlightRequested fired when the node should be highlighted.
// This happens after call to setInspectMode.
type EventNodeHighlightRequested struct {
NodeID cdp.NodeID `json:"nodeId,omitempty"`
}
// EventInspectNodeRequested fired when the node should be inspected. This
// happens after call to setInspectMode or when user manually inspects an
// element.
type EventInspectNodeRequested struct {
BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty"` // Id of the node to inspect.
}
// EventTypes all event types in the domain.
var EventTypes = []cdp.MethodType{
cdp.EventOverlayNodeHighlightRequested,
cdp.EventOverlayInspectNodeRequested,
}

449
cdp/overlay/overlay.go Normal file
View File

@ -0,0 +1,449 @@
// Package overlay provides the Chrome Debugging Protocol
// commands, types, and events for the Overlay domain.
//
// This domain provides various functionality related to drawing atop the
// inspected page.
//
// Generated by the chromedp-gen command.
package overlay
// AUTOGENERATED. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/dom"
"github.com/knq/chromedp/cdp/runtime"
"github.com/mailru/easyjson"
)
// EnableParams enables domain notifications.
type EnableParams struct{}
// Enable enables domain notifications.
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes Overlay.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlayEnable, nil, nil)
}
// DisableParams disables domain notifications.
type DisableParams struct{}
// Disable disables domain notifications.
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes Overlay.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlayDisable, nil, 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.
//
// parameters:
// result - True for showing paint rectangles
func SetShowPaintRects(result bool) *SetShowPaintRectsParams {
return &SetShowPaintRectsParams{
Result: result,
}
}
// Do executes Overlay.setShowPaintRects against the provided context and
// target handler.
func (p *SetShowPaintRectsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlaySetShowPaintRects, 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.
//
// parameters:
// show - True for showing debug borders
func SetShowDebugBorders(show bool) *SetShowDebugBordersParams {
return &SetShowDebugBordersParams{
Show: show,
}
}
// Do executes Overlay.setShowDebugBorders against the provided context and
// target handler.
func (p *SetShowDebugBordersParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlaySetShowDebugBorders, 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.
//
// 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 and
// target handler.
func (p *SetShowFPSCounterParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlaySetShowFPSCounter, 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.
//
// 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 and
// target handler.
func (p *SetShowScrollBottleneckRectsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlaySetShowScrollBottleneckRects, 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.
//
// 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 and
// target handler.
func (p *SetShowViewportSizeOnResizeParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlaySetShowViewportSizeOnResize, 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].
//
// 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 and
// target handler.
func (p *SetPausedInDebuggerMessageParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlaySetPausedInDebuggerMessage, p, nil)
}
// SetSuspendedParams [no description].
type SetSuspendedParams struct {
Suspended bool `json:"suspended"` // Whether overlay should be suspended and not consume any resources until resumed.
}
// SetSuspended [no description].
//
// parameters:
// suspended - Whether overlay should be suspended and not consume any resources until resumed.
func SetSuspended(suspended bool) *SetSuspendedParams {
return &SetSuspendedParams{
Suspended: suspended,
}
}
// Do executes Overlay.setSuspended against the provided context and
// target handler.
func (p *SetSuspendedParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlaySetSuspended, 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.
//
// 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 and
// target handler.
func (p *SetInspectModeParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlaySetInspectMode, 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.
//
// 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 and
// target handler.
func (p *HighlightRectParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlayHighlightRect, 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.
//
// 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 and
// target handler.
func (p *HighlightQuadParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlayHighlightQuad, 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.
}
// HighlightNode highlights DOM node with given id or with the given
// JavaScript object wrapper. Either nodeId or objectId must be specified.
//
// 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
}
// Do executes Overlay.highlightNode against the provided context and
// target handler.
func (p *HighlightNodeParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlayHighlightNode, p, 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.
//
// 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 and
// target handler.
func (p *HighlightFrameParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlayHighlightFrame, p, nil)
}
// HideHighlightParams hides any highlight.
type HideHighlightParams struct{}
// HideHighlight hides any highlight.
func HideHighlight() *HideHighlightParams {
return &HideHighlightParams{}
}
// Do executes Overlay.hideHighlight against the provided context and
// target handler.
func (p *HideHighlightParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlayHideHighlight, nil, nil)
}
// GetHighlightObjectForTestParams for testing.
type GetHighlightObjectForTestParams struct {
NodeID cdp.NodeID `json:"nodeId"` // Id of the node to get highlight object for.
}
// GetHighlightObjectForTest for testing.
//
// parameters:
// nodeID - Id of the node to get highlight object for.
func GetHighlightObjectForTest(nodeID cdp.NodeID) *GetHighlightObjectForTestParams {
return &GetHighlightObjectForTestParams{
NodeID: nodeID,
}
}
// GetHighlightObjectForTestReturns return values.
type GetHighlightObjectForTestReturns struct {
Highlight easyjson.RawMessage `json:"highlight,omitempty"`
}
// Do executes Overlay.getHighlightObjectForTest against the provided context and
// target handler.
//
// returns:
// highlight - Highlight data for the node.
func (p *GetHighlightObjectForTestParams) Do(ctxt context.Context, h cdp.Handler) (highlight easyjson.RawMessage, err error) {
// execute
var res GetHighlightObjectForTestReturns
err = h.Execute(ctxt, cdp.CommandOverlayGetHighlightObjectForTest, p, &res)
if err != nil {
return nil, err
}
return res.Highlight, nil
}

73
cdp/overlay/types.go Normal file
View File

@ -0,0 +1,73 @@
package overlay
// AUTOGENERATED. DO NOT EDIT.
import (
"errors"
cdp "github.com/knq/chromedp/cdp"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// HighlightConfig configuration data for the highlighting of page elements.
type HighlightConfig struct {
ShowInfo bool `json:"showInfo,omitempty"` // Whether the node info tooltip should be shown (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).
DisplayAsMaterial bool `json:"displayAsMaterial,omitempty"`
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).
SelectorList string `json:"selectorList,omitempty"` // Selectors to highlight relevant nodes.
}
// InspectMode [no description].
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"
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 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)
}

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package page package page
@ -4441,86 +4441,7 @@ func (v *DisableParams) UnmarshalJSON(data []byte) error {
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage53(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage53(l, v)
} }
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage54(in *jlexer.Lexer, out *ConfigureOverlayParams) { func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage54(in *jlexer.Lexer, out *CaptureScreenshotReturns) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "suspended":
out.Suspended = bool(in.Bool())
case "message":
out.Message = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage54(out *jwriter.Writer, in ConfigureOverlayParams) {
out.RawByte('{')
first := true
_ = first
if in.Suspended {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"suspended\":")
out.Bool(bool(in.Suspended))
}
if in.Message != "" {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"message\":")
out.String(string(in.Message))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v ConfigureOverlayParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage54(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ConfigureOverlayParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage54(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ConfigureOverlayParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage54(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ConfigureOverlayParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage54(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage55(in *jlexer.Lexer, out *CaptureScreenshotReturns) {
isTopLevel := in.IsStart() isTopLevel := in.IsStart()
if in.IsNull() { if in.IsNull() {
if isTopLevel { if isTopLevel {
@ -4551,7 +4472,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage55(in *jlexer.Lexer, out *
in.Consumed() in.Consumed()
} }
} }
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage55(out *jwriter.Writer, in CaptureScreenshotReturns) { func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage54(out *jwriter.Writer, in CaptureScreenshotReturns) {
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
@ -4569,27 +4490,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage55(out *jwriter.Writer, in
// MarshalJSON supports json.Marshaler interface // MarshalJSON supports json.Marshaler interface
func (v CaptureScreenshotReturns) MarshalJSON() ([]byte, error) { func (v CaptureScreenshotReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{} w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage55(&w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage54(&w, v)
return w.Buffer.BuildBytes(), w.Error return w.Buffer.BuildBytes(), w.Error
} }
// MarshalEasyJSON supports easyjson.Marshaler interface // MarshalEasyJSON supports easyjson.Marshaler interface
func (v CaptureScreenshotReturns) MarshalEasyJSON(w *jwriter.Writer) { func (v CaptureScreenshotReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage55(w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage54(w, v)
} }
// UnmarshalJSON supports json.Unmarshaler interface // UnmarshalJSON supports json.Unmarshaler interface
func (v *CaptureScreenshotReturns) UnmarshalJSON(data []byte) error { func (v *CaptureScreenshotReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data} r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage55(&r, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage54(&r, v)
return r.Error() return r.Error()
} }
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *CaptureScreenshotReturns) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *CaptureScreenshotReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage55(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage54(l, v)
} }
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage56(in *jlexer.Lexer, out *CaptureScreenshotParams) { func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage55(in *jlexer.Lexer, out *CaptureScreenshotParams) {
isTopLevel := in.IsStart() isTopLevel := in.IsStart()
if in.IsNull() { if in.IsNull() {
if isTopLevel { if isTopLevel {
@ -4624,7 +4545,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage56(in *jlexer.Lexer, out *
in.Consumed() in.Consumed()
} }
} }
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage56(out *jwriter.Writer, in CaptureScreenshotParams) { func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage55(out *jwriter.Writer, in CaptureScreenshotParams) {
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
@ -4658,27 +4579,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage56(out *jwriter.Writer, in
// MarshalJSON supports json.Marshaler interface // MarshalJSON supports json.Marshaler interface
func (v CaptureScreenshotParams) MarshalJSON() ([]byte, error) { func (v CaptureScreenshotParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{} w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage56(&w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage55(&w, v)
return w.Buffer.BuildBytes(), w.Error return w.Buffer.BuildBytes(), w.Error
} }
// MarshalEasyJSON supports easyjson.Marshaler interface // MarshalEasyJSON supports easyjson.Marshaler interface
func (v CaptureScreenshotParams) MarshalEasyJSON(w *jwriter.Writer) { func (v CaptureScreenshotParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage56(w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage55(w, v)
} }
// UnmarshalJSON supports json.Unmarshaler interface // UnmarshalJSON supports json.Unmarshaler interface
func (v *CaptureScreenshotParams) UnmarshalJSON(data []byte) error { func (v *CaptureScreenshotParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data} r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage56(&r, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage55(&r, v)
return r.Error() return r.Error()
} }
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *CaptureScreenshotParams) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *CaptureScreenshotParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage56(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage55(l, v)
} }
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage57(in *jlexer.Lexer, out *AppManifestError) { func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage56(in *jlexer.Lexer, out *AppManifestError) {
isTopLevel := in.IsStart() isTopLevel := in.IsStart()
if in.IsNull() { if in.IsNull() {
if isTopLevel { if isTopLevel {
@ -4715,7 +4636,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage57(in *jlexer.Lexer, out *
in.Consumed() in.Consumed()
} }
} }
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage57(out *jwriter.Writer, in AppManifestError) { func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage56(out *jwriter.Writer, in AppManifestError) {
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
@ -4757,27 +4678,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage57(out *jwriter.Writer, in
// MarshalJSON supports json.Marshaler interface // MarshalJSON supports json.Marshaler interface
func (v AppManifestError) MarshalJSON() ([]byte, error) { func (v AppManifestError) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{} w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage57(&w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage56(&w, v)
return w.Buffer.BuildBytes(), w.Error return w.Buffer.BuildBytes(), w.Error
} }
// MarshalEasyJSON supports easyjson.Marshaler interface // MarshalEasyJSON supports easyjson.Marshaler interface
func (v AppManifestError) MarshalEasyJSON(w *jwriter.Writer) { func (v AppManifestError) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage57(w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage56(w, v)
} }
// UnmarshalJSON supports json.Unmarshaler interface // UnmarshalJSON supports json.Unmarshaler interface
func (v *AppManifestError) UnmarshalJSON(data []byte) error { func (v *AppManifestError) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data} r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage57(&r, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage56(&r, v)
return r.Error() return r.Error()
} }
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *AppManifestError) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *AppManifestError) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage57(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage56(l, v)
} }
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage58(in *jlexer.Lexer, out *AddScriptToEvaluateOnLoadReturns) { func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage57(in *jlexer.Lexer, out *AddScriptToEvaluateOnLoadReturns) {
isTopLevel := in.IsStart() isTopLevel := in.IsStart()
if in.IsNull() { if in.IsNull() {
if isTopLevel { if isTopLevel {
@ -4808,7 +4729,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage58(in *jlexer.Lexer, out *
in.Consumed() in.Consumed()
} }
} }
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage58(out *jwriter.Writer, in AddScriptToEvaluateOnLoadReturns) { func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage57(out *jwriter.Writer, in AddScriptToEvaluateOnLoadReturns) {
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
@ -4826,27 +4747,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage58(out *jwriter.Writer, in
// MarshalJSON supports json.Marshaler interface // MarshalJSON supports json.Marshaler interface
func (v AddScriptToEvaluateOnLoadReturns) MarshalJSON() ([]byte, error) { func (v AddScriptToEvaluateOnLoadReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{} w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage58(&w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage57(&w, v)
return w.Buffer.BuildBytes(), w.Error return w.Buffer.BuildBytes(), w.Error
} }
// MarshalEasyJSON supports easyjson.Marshaler interface // MarshalEasyJSON supports easyjson.Marshaler interface
func (v AddScriptToEvaluateOnLoadReturns) MarshalEasyJSON(w *jwriter.Writer) { func (v AddScriptToEvaluateOnLoadReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage58(w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage57(w, v)
} }
// UnmarshalJSON supports json.Unmarshaler interface // UnmarshalJSON supports json.Unmarshaler interface
func (v *AddScriptToEvaluateOnLoadReturns) UnmarshalJSON(data []byte) error { func (v *AddScriptToEvaluateOnLoadReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data} r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage58(&r, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage57(&r, v)
return r.Error() return r.Error()
} }
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *AddScriptToEvaluateOnLoadReturns) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *AddScriptToEvaluateOnLoadReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage58(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage57(l, v)
} }
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage59(in *jlexer.Lexer, out *AddScriptToEvaluateOnLoadParams) { func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage58(in *jlexer.Lexer, out *AddScriptToEvaluateOnLoadParams) {
isTopLevel := in.IsStart() isTopLevel := in.IsStart()
if in.IsNull() { if in.IsNull() {
if isTopLevel { if isTopLevel {
@ -4877,7 +4798,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage59(in *jlexer.Lexer, out *
in.Consumed() in.Consumed()
} }
} }
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage59(out *jwriter.Writer, in AddScriptToEvaluateOnLoadParams) { func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage58(out *jwriter.Writer, in AddScriptToEvaluateOnLoadParams) {
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
@ -4893,23 +4814,23 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage59(out *jwriter.Writer, in
// MarshalJSON supports json.Marshaler interface // MarshalJSON supports json.Marshaler interface
func (v AddScriptToEvaluateOnLoadParams) MarshalJSON() ([]byte, error) { func (v AddScriptToEvaluateOnLoadParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{} w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage59(&w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage58(&w, v)
return w.Buffer.BuildBytes(), w.Error return w.Buffer.BuildBytes(), w.Error
} }
// MarshalEasyJSON supports easyjson.Marshaler interface // MarshalEasyJSON supports easyjson.Marshaler interface
func (v AddScriptToEvaluateOnLoadParams) MarshalEasyJSON(w *jwriter.Writer) { func (v AddScriptToEvaluateOnLoadParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage59(w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage58(w, v)
} }
// UnmarshalJSON supports json.Unmarshaler interface // UnmarshalJSON supports json.Unmarshaler interface
func (v *AddScriptToEvaluateOnLoadParams) UnmarshalJSON(data []byte) error { func (v *AddScriptToEvaluateOnLoadParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data} r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage59(&r, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage58(&r, v)
return r.Error() return r.Error()
} }
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *AddScriptToEvaluateOnLoadParams) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *AddScriptToEvaluateOnLoadParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage59(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage58(l, v)
} }

View File

@ -647,38 +647,6 @@ func (p *HandleJavaScriptDialogParams) Do(ctxt context.Context, h cdp.Handler) (
return h.Execute(ctxt, cdp.CommandPageHandleJavaScriptDialog, p, nil) return h.Execute(ctxt, cdp.CommandPageHandleJavaScriptDialog, p, nil)
} }
// ConfigureOverlayParams configures overlay.
type ConfigureOverlayParams struct {
Suspended bool `json:"suspended,omitempty"` // Whether overlay should be suspended and not consume any resources.
Message string `json:"message,omitempty"` // Overlay message to display.
}
// ConfigureOverlay configures overlay.
//
// parameters:
func ConfigureOverlay() *ConfigureOverlayParams {
return &ConfigureOverlayParams{}
}
// WithSuspended whether overlay should be suspended and not consume any
// resources.
func (p ConfigureOverlayParams) WithSuspended(suspended bool) *ConfigureOverlayParams {
p.Suspended = suspended
return &p
}
// WithMessage overlay message to display.
func (p ConfigureOverlayParams) WithMessage(message string) *ConfigureOverlayParams {
p.Message = message
return &p
}
// Do executes Page.configureOverlay against the provided context and
// target handler.
func (p *ConfigureOverlayParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandPageConfigureOverlay, p, nil)
}
// GetAppManifestParams [no description]. // GetAppManifestParams [no description].
type GetAppManifestParams struct{} type GetAppManifestParams struct{}

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package profiler package profiler

View File

@ -7,7 +7,7 @@ import (
"github.com/knq/chromedp/cdp/debugger" "github.com/knq/chromedp/cdp/debugger"
) )
// EventConsoleProfileStarted sent when new profile recodring is started // EventConsoleProfileStarted sent when new profile recording is started
// using console.profile() call. // using console.profile() call.
type EventConsoleProfileStarted struct { type EventConsoleProfileStarted struct {
ID string `json:"id,omitempty"` ID string `json:"id,omitempty"`

View File

@ -1,354 +0,0 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers.
package rendering
import (
json "encoding/json"
easyjson "github.com/mailru/easyjson"
jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/easyjson/jwriter"
)
// suppress unused package warning
var (
_ *json.RawMessage
_ *jlexer.Lexer
_ *jwriter.Writer
_ easyjson.Marshaler
)
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering(in *jlexer.Lexer, out *SetShowViewportSizeOnResizeParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "show":
out.Show = bool(in.Bool())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering(out *jwriter.Writer, in SetShowViewportSizeOnResizeParams) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"show\":")
out.Bool(bool(in.Show))
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v SetShowViewportSizeOnResizeParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v SetShowViewportSizeOnResizeParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *SetShowViewportSizeOnResizeParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *SetShowViewportSizeOnResizeParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering1(in *jlexer.Lexer, out *SetShowScrollBottleneckRectsParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "show":
out.Show = bool(in.Bool())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering1(out *jwriter.Writer, in SetShowScrollBottleneckRectsParams) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"show\":")
out.Bool(bool(in.Show))
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v SetShowScrollBottleneckRectsParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering1(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v SetShowScrollBottleneckRectsParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering1(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *SetShowScrollBottleneckRectsParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering1(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *SetShowScrollBottleneckRectsParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering1(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering2(in *jlexer.Lexer, out *SetShowPaintRectsParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "result":
out.Result = bool(in.Bool())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering2(out *jwriter.Writer, in SetShowPaintRectsParams) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"result\":")
out.Bool(bool(in.Result))
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v SetShowPaintRectsParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering2(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v SetShowPaintRectsParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering2(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *SetShowPaintRectsParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering2(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *SetShowPaintRectsParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering2(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering3(in *jlexer.Lexer, out *SetShowFPSCounterParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "show":
out.Show = bool(in.Bool())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering3(out *jwriter.Writer, in SetShowFPSCounterParams) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"show\":")
out.Bool(bool(in.Show))
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v SetShowFPSCounterParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering3(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v SetShowFPSCounterParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering3(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *SetShowFPSCounterParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering3(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *SetShowFPSCounterParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering3(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering4(in *jlexer.Lexer, out *SetShowDebugBordersParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "show":
out.Show = bool(in.Bool())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering4(out *jwriter.Writer, in SetShowDebugBordersParams) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"show\":")
out.Bool(bool(in.Show))
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v SetShowDebugBordersParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering4(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v SetShowDebugBordersParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering4(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *SetShowDebugBordersParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering4(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *SetShowDebugBordersParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering4(l, v)
}

View File

@ -1,124 +0,0 @@
// Package rendering provides the Chrome Debugging Protocol
// commands, types, and events for the Rendering domain.
//
// This domain allows to control rendering of the page.
//
// Generated by the chromedp-gen command.
package rendering
// AUTOGENERATED. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
)
// 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.
//
// parameters:
// result - True for showing paint rectangles
func SetShowPaintRects(result bool) *SetShowPaintRectsParams {
return &SetShowPaintRectsParams{
Result: result,
}
}
// Do executes Rendering.setShowPaintRects against the provided context and
// target handler.
func (p *SetShowPaintRectsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandRenderingSetShowPaintRects, 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.
//
// parameters:
// show - True for showing debug borders
func SetShowDebugBorders(show bool) *SetShowDebugBordersParams {
return &SetShowDebugBordersParams{
Show: show,
}
}
// Do executes Rendering.setShowDebugBorders against the provided context and
// target handler.
func (p *SetShowDebugBordersParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandRenderingSetShowDebugBorders, 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.
//
// parameters:
// show - True for showing the FPS counter
func SetShowFPSCounter(show bool) *SetShowFPSCounterParams {
return &SetShowFPSCounterParams{
Show: show,
}
}
// Do executes Rendering.setShowFPSCounter against the provided context and
// target handler.
func (p *SetShowFPSCounterParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandRenderingSetShowFPSCounter, 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.
//
// parameters:
// show - True for showing scroll bottleneck rects
func SetShowScrollBottleneckRects(show bool) *SetShowScrollBottleneckRectsParams {
return &SetShowScrollBottleneckRectsParams{
Show: show,
}
}
// Do executes Rendering.setShowScrollBottleneckRects against the provided context and
// target handler.
func (p *SetShowScrollBottleneckRectsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandRenderingSetShowScrollBottleneckRects, 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.
//
// parameters:
// show - Whether to paint size or not.
func SetShowViewportSizeOnResize(show bool) *SetShowViewportSizeOnResizeParams {
return &SetShowViewportSizeOnResizeParams{
Show: show,
}
}
// Do executes Rendering.setShowViewportSizeOnResize against the provided context and
// target handler.
func (p *SetShowViewportSizeOnResizeParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandRenderingSetShowViewportSizeOnResize, p, nil)
}

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package runtime package runtime

View File

@ -9,7 +9,7 @@ import (
// EventExecutionContextCreated issued when new execution context is created. // EventExecutionContextCreated issued when new execution context is created.
type EventExecutionContextCreated struct { type EventExecutionContextCreated struct {
Context *ExecutionContextDescription `json:"context,omitempty"` // A newly created execution contex. Context *ExecutionContextDescription `json:"context,omitempty"` // A newly created execution context.
} }
// EventExecutionContextDestroyed issued when execution context is destroyed. // EventExecutionContextDestroyed issued when execution context is destroyed.

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package schema package schema

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package security package security

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package serviceworker package serviceworker

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package storage package storage

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package systeminfo package systeminfo

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package target package target

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package tethering package tethering

View File

@ -1,4 +1,4 @@
// AUTOGENERATED FILE: easyjson marshaler/unmarshalers. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package tracing package tracing

View File

@ -0,0 +1,102 @@
// +build ignore
package main
import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"os/exec"
"sort"
)
var (
flagFile = flag.String("file", "protocol.json", "path to protocol.json")
flagOut = flag.String("out", "internal/domain.go", "out file")
)
func main() {
var v struct {
Domains []struct {
Domain string `json:"domain"`
} `json:"domains"`
}
buf, err := ioutil.ReadFile(*flagFile)
if err != nil {
log.Fatal(err)
}
err = json.Unmarshal(buf, &v)
if err != nil {
log.Fatal(err)
}
var domains []string
for _, d := range v.Domains {
domains = append(domains, d.Domain)
}
sort.Strings(domains)
var a, b string
for _, s := range domains {
a += fmt.Sprintf("Domain%s DomainType = \"%s\"\n", s, s)
b += fmt.Sprintf("case Domain%s:\n*dt = Domain%s\n", s, s)
}
buf = []byte(fmt.Sprintf(tpl, a, b))
err = ioutil.WriteFile(*flagOut, buf, 0644)
if err != nil {
log.Fatal(err)
}
err = exec.Command("gofmt", "-w", "-s", *flagOut).Run()
if err != nil {
log.Fatal(err)
}
}
const (
tpl = `package internal
import (
"fmt"
"strconv"
)
// DomainType is the Chrome domain type.
type DomainType string
// DomainType values.
const (
%s)
// String satisfies Stringer.
func (dt DomainType) String() string {
return string(dt)
}
// MarshalJSON satisfies json.Marshaler.
func (dt DomainType) MarshalJSON() ([]byte, error) {
return []byte("\"" + dt + "\""), nil
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (dt *DomainType) UnmarshalJSON(buf []byte) error {
s, err := strconv.Unquote(string(buf))
if err != nil {
return err
}
switch DomainType(s) {
%s
default:
return fmt.Errorf("unknown domain type %%s", string(buf))
}
return nil
}
`
)

View File

@ -274,8 +274,6 @@ func FixDomains(domains []*internal.Domain) {
}, },
) )
t.Extra += templates.ExtraNodeTemplate() t.Extra += templates.ExtraNodeTemplate()
break
} }
} }

View File

@ -0,0 +1,144 @@
package internal
import (
"fmt"
"strconv"
)
// DomainType is the Chrome domain type.
type DomainType string
// DomainType values.
const (
DomainAccessibility DomainType = "Accessibility"
DomainAnimation DomainType = "Animation"
DomainApplicationCache DomainType = "ApplicationCache"
DomainBrowser DomainType = "Browser"
DomainCSS DomainType = "CSS"
DomainCacheStorage DomainType = "CacheStorage"
DomainConsole DomainType = "Console"
DomainDOM DomainType = "DOM"
DomainDOMDebugger DomainType = "DOMDebugger"
DomainDOMStorage DomainType = "DOMStorage"
DomainDatabase DomainType = "Database"
DomainDebugger DomainType = "Debugger"
DomainDeviceOrientation DomainType = "DeviceOrientation"
DomainEmulation DomainType = "Emulation"
DomainHeapProfiler DomainType = "HeapProfiler"
DomainIO DomainType = "IO"
DomainIndexedDB DomainType = "IndexedDB"
DomainInput DomainType = "Input"
DomainInspector DomainType = "Inspector"
DomainLayerTree DomainType = "LayerTree"
DomainLog DomainType = "Log"
DomainMemory DomainType = "Memory"
DomainNetwork DomainType = "Network"
DomainOverlay DomainType = "Overlay"
DomainPage DomainType = "Page"
DomainProfiler DomainType = "Profiler"
DomainRuntime DomainType = "Runtime"
DomainSchema DomainType = "Schema"
DomainSecurity DomainType = "Security"
DomainServiceWorker DomainType = "ServiceWorker"
DomainStorage DomainType = "Storage"
DomainSystemInfo DomainType = "SystemInfo"
DomainTarget DomainType = "Target"
DomainTethering DomainType = "Tethering"
DomainTracing DomainType = "Tracing"
)
// String satisfies Stringer.
func (dt DomainType) String() string {
return string(dt)
}
// MarshalJSON satisfies json.Marshaler.
func (dt DomainType) MarshalJSON() ([]byte, error) {
return []byte("\"" + dt + "\""), nil
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (dt *DomainType) UnmarshalJSON(buf []byte) error {
s, err := strconv.Unquote(string(buf))
if err != nil {
return err
}
switch DomainType(s) {
case DomainAccessibility:
*dt = DomainAccessibility
case DomainAnimation:
*dt = DomainAnimation
case DomainApplicationCache:
*dt = DomainApplicationCache
case DomainBrowser:
*dt = DomainBrowser
case DomainCSS:
*dt = DomainCSS
case DomainCacheStorage:
*dt = DomainCacheStorage
case DomainConsole:
*dt = DomainConsole
case DomainDOM:
*dt = DomainDOM
case DomainDOMDebugger:
*dt = DomainDOMDebugger
case DomainDOMStorage:
*dt = DomainDOMStorage
case DomainDatabase:
*dt = DomainDatabase
case DomainDebugger:
*dt = DomainDebugger
case DomainDeviceOrientation:
*dt = DomainDeviceOrientation
case DomainEmulation:
*dt = DomainEmulation
case DomainHeapProfiler:
*dt = DomainHeapProfiler
case DomainIO:
*dt = DomainIO
case DomainIndexedDB:
*dt = DomainIndexedDB
case DomainInput:
*dt = DomainInput
case DomainInspector:
*dt = DomainInspector
case DomainLayerTree:
*dt = DomainLayerTree
case DomainLog:
*dt = DomainLog
case DomainMemory:
*dt = DomainMemory
case DomainNetwork:
*dt = DomainNetwork
case DomainOverlay:
*dt = DomainOverlay
case DomainPage:
*dt = DomainPage
case DomainProfiler:
*dt = DomainProfiler
case DomainRuntime:
*dt = DomainRuntime
case DomainSchema:
*dt = DomainSchema
case DomainSecurity:
*dt = DomainSecurity
case DomainServiceWorker:
*dt = DomainServiceWorker
case DomainStorage:
*dt = DomainStorage
case DomainSystemInfo:
*dt = DomainSystemInfo
case DomainTarget:
*dt = DomainTarget
case DomainTethering:
*dt = DomainTethering
case DomainTracing:
*dt = DomainTracing
default:
return fmt.Errorf("unknown domain type %s", string(buf))
}
return nil
}

View File

@ -5,186 +5,6 @@ import (
"strconv" "strconv"
) )
// DomainType is the Chrome domain type.
type DomainType string
/*
Accessibility
Animation
ApplicationCache
Browser
CacheStorage
Console
CSS
Database
Debugger
DeviceOrientation
DOM
DOMDebugger
DOMStorage
Emulation
HeapProfiler
IndexedDB
Input
Inspector
IO
LayerTree
Log
Memory
Network
Page
Profiler
Rendering
Runtime
Schema
Security
ServiceWorker
Storage
SystemInfo
Target
Tethering
Tracing
*/
// generated with:
// '<,'>s/^\(.*\)$/Domain\1 DomainType = "\1"/
const (
DomainAccessibility DomainType = "Accessibility"
DomainAnimation DomainType = "Animation"
DomainApplicationCache DomainType = "ApplicationCache"
DomainBrowser DomainType = "Browser"
DomainCacheStorage DomainType = "CacheStorage"
DomainConsole DomainType = "Console"
DomainCSS DomainType = "CSS"
DomainDatabase DomainType = "Database"
DomainDebugger DomainType = "Debugger"
DomainDeviceOrientation DomainType = "DeviceOrientation"
DomainDOM DomainType = "DOM"
DomainDOMDebugger DomainType = "DOMDebugger"
DomainDOMStorage DomainType = "DOMStorage"
DomainEmulation DomainType = "Emulation"
DomainHeapProfiler DomainType = "HeapProfiler"
DomainIndexedDB DomainType = "IndexedDB"
DomainInput DomainType = "Input"
DomainInspector DomainType = "Inspector"
DomainIO DomainType = "IO"
DomainLayerTree DomainType = "LayerTree"
DomainLog DomainType = "Log"
DomainMemory DomainType = "Memory"
DomainNetwork DomainType = "Network"
DomainPage DomainType = "Page"
DomainProfiler DomainType = "Profiler"
DomainRendering DomainType = "Rendering"
DomainRuntime DomainType = "Runtime"
DomainSchema DomainType = "Schema"
DomainSecurity DomainType = "Security"
DomainServiceWorker DomainType = "ServiceWorker"
DomainStorage DomainType = "Storage"
DomainSystemInfo DomainType = "SystemInfo"
DomainTarget DomainType = "Target"
DomainTethering DomainType = "Tethering"
DomainTracing DomainType = "Tracing"
)
// String satisfies Stringer.
func (dt DomainType) String() string {
return string(dt)
}
// MarshalJSON satisfies json.Marshaler.
func (dt DomainType) MarshalJSON() ([]byte, error) {
return []byte(`"` + dt + `"`), nil
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (dt *DomainType) UnmarshalJSON(buf []byte) error {
s, err := strconv.Unquote(string(buf))
if err != nil {
return err
}
switch DomainType(s) {
// generated with:
// '<,'>s/^\(.*\)$/case Domain\1:\r\t*dt = Domain\1/
case DomainAccessibility:
*dt = DomainAccessibility
case DomainAnimation:
*dt = DomainAnimation
case DomainApplicationCache:
*dt = DomainApplicationCache
case DomainBrowser:
*dt = DomainBrowser
case DomainCacheStorage:
*dt = DomainCacheStorage
case DomainConsole:
*dt = DomainConsole
case DomainCSS:
*dt = DomainCSS
case DomainDatabase:
*dt = DomainDatabase
case DomainDebugger:
*dt = DomainDebugger
case DomainDeviceOrientation:
*dt = DomainDeviceOrientation
case DomainDOM:
*dt = DomainDOM
case DomainDOMDebugger:
*dt = DomainDOMDebugger
case DomainDOMStorage:
*dt = DomainDOMStorage
case DomainEmulation:
*dt = DomainEmulation
case DomainHeapProfiler:
*dt = DomainHeapProfiler
case DomainIndexedDB:
*dt = DomainIndexedDB
case DomainInput:
*dt = DomainInput
case DomainInspector:
*dt = DomainInspector
case DomainIO:
*dt = DomainIO
case DomainLayerTree:
*dt = DomainLayerTree
case DomainLog:
*dt = DomainLog
case DomainMemory:
*dt = DomainMemory
case DomainNetwork:
*dt = DomainNetwork
case DomainPage:
*dt = DomainPage
case DomainProfiler:
*dt = DomainProfiler
case DomainRendering:
*dt = DomainRendering
case DomainRuntime:
*dt = DomainRuntime
case DomainSchema:
*dt = DomainSchema
case DomainSecurity:
*dt = DomainSecurity
case DomainServiceWorker:
*dt = DomainServiceWorker
case DomainStorage:
*dt = DomainStorage
case DomainSystemInfo:
*dt = DomainSystemInfo
case DomainTarget:
*dt = DomainTarget
case DomainTethering:
*dt = DomainTethering
case DomainTracing:
*dt = DomainTracing
default:
return fmt.Errorf("unknown domain type %s", string(buf))
}
return nil
}
// HandlerType are the handler targets for commands and events. // HandlerType are the handler targets for commands and events.
type HandlerType string type HandlerType string

View File

@ -4,6 +4,7 @@
// Please see README.md for more information on using this tool. // Please see README.md for more information on using this tool.
package main package main
//go:generate go run domain-gen.go
//go:generate qtc -dir templates -ext qtpl //go:generate qtc -dir templates -ext qtpl
import ( import (
@ -24,10 +25,8 @@ import (
) )
func main() { func main() {
var err error
// parse flags // parse flags
err = internal.FlagSet.Parse(os.Args[1:]) err := internal.FlagSet.Parse(os.Args[1:])
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err) fmt.Fprintf(os.Stderr, "error: %v\n", err)
os.Exit(1) os.Exit(1)

View File

@ -1007,25 +1007,6 @@
} }
] ]
}, },
{
"name": "configureOverlay",
"parameters": [
{
"name": "suspended",
"type": "boolean",
"optional": true,
"description": "Whether overlay should be suspended and not consume any resources."
},
{
"name": "message",
"type": "string",
"optional": true,
"description": "Overlay message to display."
}
],
"experimental": true,
"description": "Configures overlay."
},
{ {
"name": "getAppManifest", "name": "getAppManifest",
"experimental": true, "experimental": true,
@ -1321,10 +1302,112 @@
] ]
}, },
{ {
"domain": "Rendering", "domain": "Overlay",
"description": "This domain allows to control rendering of the page.", "description": "This domain provides various functionality related to drawing atop the inspected page.",
"dependencies": [
"DOM",
"Page",
"Runtime"
],
"experimental": true, "experimental": true,
"types": [
{
"id": "HighlightConfig",
"type": "object",
"properties": [
{
"name": "showInfo",
"type": "boolean",
"optional": true,
"description": "Whether the node info tooltip should be shown (default: false)."
},
{
"name": "showRulers",
"type": "boolean",
"optional": true,
"description": "Whether the rulers should be shown (default: false)."
},
{
"name": "showExtensionLines",
"type": "boolean",
"optional": true,
"description": "Whether the extension lines from node to the rulers should be shown (default: false)."
},
{
"name": "displayAsMaterial",
"type": "boolean",
"optional": true
},
{
"name": "contentColor",
"$ref": "DOM.RGBA",
"optional": true,
"description": "The content box highlight fill color (default: transparent)."
},
{
"name": "paddingColor",
"$ref": "DOM.RGBA",
"optional": true,
"description": "The padding highlight fill color (default: transparent)."
},
{
"name": "borderColor",
"$ref": "DOM.RGBA",
"optional": true,
"description": "The border highlight fill color (default: transparent)."
},
{
"name": "marginColor",
"$ref": "DOM.RGBA",
"optional": true,
"description": "The margin highlight fill color (default: transparent)."
},
{
"name": "eventTargetColor",
"$ref": "DOM.RGBA",
"optional": true,
"description": "The event target element highlight fill color (default: transparent)."
},
{
"name": "shapeColor",
"$ref": "DOM.RGBA",
"optional": true,
"description": "The shape outside fill color (default: transparent)."
},
{
"name": "shapeMarginColor",
"$ref": "DOM.RGBA",
"optional": true,
"description": "The shape margin fill color (default: transparent)."
},
{
"name": "selectorList",
"type": "string",
"optional": true,
"description": "Selectors to highlight relevant nodes."
}
],
"description": "Configuration data for the highlighting of page elements."
},
{
"id": "InspectMode",
"type": "string",
"enum": [
"searchForNode",
"searchForUAShadowDOM",
"none"
]
}
],
"commands": [ "commands": [
{
"name": "enable",
"description": "Enables domain notifications."
},
{
"name": "disable",
"description": "Disables domain notifications."
},
{ {
"name": "setShowPaintRects", "name": "setShowPaintRects",
"description": "Requests that backend shows paint rectangles", "description": "Requests that backend shows paint rectangles",
@ -1379,6 +1462,202 @@
"description": "Whether to paint size or not." "description": "Whether to paint size or not."
} }
] ]
},
{
"name": "setPausedInDebuggerMessage",
"parameters": [
{
"name": "message",
"type": "string",
"optional": true,
"description": "The message to display, also triggers resume and step over controls."
}
]
},
{
"name": "setSuspended",
"parameters": [
{
"name": "suspended",
"type": "boolean",
"description": "Whether overlay should be suspended and not consume any resources until resumed."
}
]
},
{
"name": "setInspectMode",
"description": "Enters the 'inspect' mode. In this mode, elements that user is hovering over are highlighted. Backend then generates 'inspectNodeRequested' event upon element selection.",
"parameters": [
{
"name": "mode",
"$ref": "InspectMode",
"description": "Set an inspection mode."
},
{
"name": "highlightConfig",
"$ref": "HighlightConfig",
"optional": true,
"description": "A descriptor for the highlight appearance of hovered-over nodes. May be omitted if <code>enabled == false</code>."
}
]
},
{
"name": "highlightRect",
"description": "Highlights given rectangle. Coordinates are absolute with respect to the main frame viewport.",
"parameters": [
{
"name": "x",
"type": "integer",
"description": "X coordinate"
},
{
"name": "y",
"type": "integer",
"description": "Y coordinate"
},
{
"name": "width",
"type": "integer",
"description": "Rectangle width"
},
{
"name": "height",
"type": "integer",
"description": "Rectangle height"
},
{
"name": "color",
"$ref": "DOM.RGBA",
"optional": true,
"description": "The highlight fill color (default: transparent)."
},
{
"name": "outlineColor",
"$ref": "DOM.RGBA",
"optional": true,
"description": "The highlight outline color (default: transparent)."
}
]
},
{
"name": "highlightQuad",
"description": "Highlights given quad. Coordinates are absolute with respect to the main frame viewport.",
"parameters": [
{
"name": "quad",
"$ref": "DOM.Quad",
"description": "Quad to highlight"
},
{
"name": "color",
"$ref": "DOM.RGBA",
"optional": true,
"description": "The highlight fill color (default: transparent)."
},
{
"name": "outlineColor",
"$ref": "DOM.RGBA",
"optional": true,
"description": "The highlight outline color (default: transparent)."
}
]
},
{
"name": "highlightNode",
"description": "Highlights DOM node with given id or with the given JavaScript object wrapper. Either nodeId or objectId must be specified.",
"parameters": [
{
"name": "highlightConfig",
"$ref": "HighlightConfig",
"description": "A descriptor for the highlight appearance."
},
{
"name": "nodeId",
"$ref": "DOM.NodeId",
"optional": true,
"description": "Identifier of the node to highlight."
},
{
"name": "backendNodeId",
"$ref": "DOM.BackendNodeId",
"optional": true,
"description": "Identifier of the backend node to highlight."
},
{
"name": "objectId",
"$ref": "Runtime.RemoteObjectId",
"optional": true,
"description": "JavaScript object id of the node to be highlighted."
}
]
},
{
"name": "highlightFrame",
"description": "Highlights owner element of the frame with given id.",
"parameters": [
{
"name": "frameId",
"$ref": "Page.FrameId",
"description": "Identifier of the frame to highlight."
},
{
"name": "contentColor",
"$ref": "DOM.RGBA",
"optional": true,
"description": "The content box highlight fill color (default: transparent)."
},
{
"name": "contentOutlineColor",
"$ref": "DOM.RGBA",
"optional": true,
"description": "The content box highlight outline color (default: transparent)."
}
]
},
{
"name": "hideHighlight",
"description": "Hides any highlight."
},
{
"name": "getHighlightObjectForTest",
"description": "For testing.",
"parameters": [
{
"name": "nodeId",
"$ref": "DOM.NodeId",
"description": "Id of the node to get highlight object for."
}
],
"returns": [
{
"name": "highlight",
"type": "object",
"description": "Highlight data for the node."
}
]
}
],
"events": [
{
"name": "nodeHighlightRequested",
"description": "Fired when the node should be highlighted. This happens after call to <code>setInspectMode</code>.",
"parameters": [
{
"name": "nodeId",
"$ref": "DOM.NodeId"
}
]
},
{
"name": "inspectNodeRequested",
"description": "Fired when the node should be inspected. This happens after call to <code>setInspectMode</code> or when user manually inspects an element.",
"parameters": [
{
"name": "backendNodeId",
"$ref": "DOM.BackendNodeId",
"description": "Id of the node to inspect."
}
]
} }
] ]
}, },
@ -4728,98 +5007,6 @@
} }
], ],
"description": "Rectangle." "description": "Rectangle."
},
{
"id": "HighlightConfig",
"type": "object",
"properties": [
{
"name": "showInfo",
"type": "boolean",
"optional": true,
"description": "Whether the node info tooltip should be shown (default: false)."
},
{
"name": "showRulers",
"type": "boolean",
"optional": true,
"description": "Whether the rulers should be shown (default: false)."
},
{
"name": "showExtensionLines",
"type": "boolean",
"optional": true,
"description": "Whether the extension lines from node to the rulers should be shown (default: false)."
},
{
"name": "displayAsMaterial",
"type": "boolean",
"optional": true,
"experimental": true
},
{
"name": "contentColor",
"$ref": "RGBA",
"optional": true,
"description": "The content box highlight fill color (default: transparent)."
},
{
"name": "paddingColor",
"$ref": "RGBA",
"optional": true,
"description": "The padding highlight fill color (default: transparent)."
},
{
"name": "borderColor",
"$ref": "RGBA",
"optional": true,
"description": "The border highlight fill color (default: transparent)."
},
{
"name": "marginColor",
"$ref": "RGBA",
"optional": true,
"description": "The margin highlight fill color (default: transparent)."
},
{
"name": "eventTargetColor",
"$ref": "RGBA",
"optional": true,
"experimental": true,
"description": "The event target element highlight fill color (default: transparent)."
},
{
"name": "shapeColor",
"$ref": "RGBA",
"optional": true,
"experimental": true,
"description": "The shape outside fill color (default: transparent)."
},
{
"name": "shapeMarginColor",
"$ref": "RGBA",
"optional": true,
"experimental": true,
"description": "The shape margin fill color (default: transparent)."
},
{
"name": "selectorList",
"type": "string",
"optional": true,
"description": "Selectors to highlight relevant nodes."
}
],
"description": "Configuration data for the highlighting of page elements."
},
{
"id": "InspectMode",
"type": "string",
"experimental": true,
"enum": [
"searchForNode",
"searchForUAShadowDOM",
"none"
]
} }
], ],
"commands": [ "commands": [
@ -5220,143 +5407,20 @@
], ],
"description": "Requests that the node is sent to the caller given the JavaScript node object reference. All nodes that form the path from the node to the root are also sent to the client as a series of <code>setChildNodes</code> notifications." "description": "Requests that the node is sent to the caller given the JavaScript node object reference. All nodes that form the path from the node to the root are also sent to the client as a series of <code>setChildNodes</code> notifications."
}, },
{
"name": "setInspectMode",
"experimental": true,
"parameters": [
{
"name": "mode",
"$ref": "InspectMode",
"description": "Set an inspection mode."
},
{
"name": "highlightConfig",
"$ref": "HighlightConfig",
"optional": true,
"description": "A descriptor for the highlight appearance of hovered-over nodes. May be omitted if <code>enabled == false</code>."
}
],
"description": "Enters the 'inspect' mode. In this mode, elements that user is hovering over are highlighted. Backend then generates 'inspectNodeRequested' event upon element selection."
},
{ {
"name": "highlightRect", "name": "highlightRect",
"parameters": [ "description": "Highlights given rectangle.",
{ "redirect": "Overlay"
"name": "x",
"type": "integer",
"description": "X coordinate"
},
{
"name": "y",
"type": "integer",
"description": "Y coordinate"
},
{
"name": "width",
"type": "integer",
"description": "Rectangle width"
},
{
"name": "height",
"type": "integer",
"description": "Rectangle height"
},
{
"name": "color",
"$ref": "RGBA",
"optional": true,
"description": "The highlight fill color (default: transparent)."
},
{
"name": "outlineColor",
"$ref": "RGBA",
"optional": true,
"description": "The highlight outline color (default: transparent)."
}
],
"description": "Highlights given rectangle. Coordinates are absolute with respect to the main frame viewport."
},
{
"name": "highlightQuad",
"parameters": [
{
"name": "quad",
"$ref": "Quad",
"description": "Quad to highlight"
},
{
"name": "color",
"$ref": "RGBA",
"optional": true,
"description": "The highlight fill color (default: transparent)."
},
{
"name": "outlineColor",
"$ref": "RGBA",
"optional": true,
"description": "The highlight outline color (default: transparent)."
}
],
"description": "Highlights given quad. Coordinates are absolute with respect to the main frame viewport.",
"experimental": true
}, },
{ {
"name": "highlightNode", "name": "highlightNode",
"parameters": [ "description": "Highlights DOM node.",
{ "redirect": "Overlay"
"name": "highlightConfig",
"$ref": "HighlightConfig",
"description": "A descriptor for the highlight appearance."
},
{
"name": "nodeId",
"$ref": "NodeId",
"optional": true,
"description": "Identifier of the node to highlight."
},
{
"name": "backendNodeId",
"$ref": "BackendNodeId",
"optional": true,
"description": "Identifier of the backend node to highlight."
},
{
"name": "objectId",
"$ref": "Runtime.RemoteObjectId",
"optional": true,
"description": "JavaScript object id of the node to be highlighted.",
"experimental": true
}
],
"description": "Highlights DOM node with given id or with the given JavaScript object wrapper. Either nodeId or objectId must be specified."
}, },
{ {
"name": "hideHighlight", "name": "hideHighlight",
"description": "Hides DOM node highlight." "description": "Hides any highlight.",
}, "redirect": "Overlay"
{
"name": "highlightFrame",
"parameters": [
{
"name": "frameId",
"$ref": "Page.FrameId",
"description": "Identifier of the frame to highlight."
},
{
"name": "contentColor",
"$ref": "RGBA",
"optional": true,
"description": "The content box highlight fill color (default: transparent)."
},
{
"name": "contentOutlineColor",
"$ref": "RGBA",
"optional": true,
"description": "The content box highlight outline color (default: transparent)."
}
],
"description": "Highlights owner element of the frame with given id.",
"experimental": true
}, },
{ {
"name": "pushNodeByPathToFrontend", "name": "pushNodeByPathToFrontend",
@ -5632,25 +5696,6 @@
], ],
"description": "Returns the id of the nearest ancestor that is a relayout boundary.", "description": "Returns the id of the nearest ancestor that is a relayout boundary.",
"experimental": true "experimental": true
},
{
"name": "getHighlightObjectForTest",
"parameters": [
{
"name": "nodeId",
"$ref": "NodeId",
"description": "Id of the node to get highlight object for."
}
],
"returns": [
{
"name": "highlight",
"type": "object",
"description": "Highlight data for the node."
}
],
"description": "For testing.",
"experimental": true
} }
], ],
"events": [ "events": [
@ -5658,18 +5703,6 @@
"name": "documentUpdated", "name": "documentUpdated",
"description": "Fired when <code>Document</code> has been totally updated. Node ids are no longer valid." "description": "Fired when <code>Document</code> has been totally updated. Node ids are no longer valid."
}, },
{
"name": "inspectNodeRequested",
"parameters": [
{
"name": "backendNodeId",
"$ref": "BackendNodeId",
"description": "Id of the node to inspect."
}
],
"description": "Fired when the node should be inspected. This happens after call to <code>setInspectMode</code>.",
"experimental": true
},
{ {
"name": "setChildNodes", "name": "setChildNodes",
"parameters": [ "parameters": [
@ -5897,16 +5930,6 @@
], ],
"description": "Called when distrubution is changed.", "description": "Called when distrubution is changed.",
"experimental": true "experimental": true
},
{
"name": "nodeHighlightRequested",
"parameters": [
{
"name": "nodeId",
"$ref": "NodeId"
}
],
"experimental": true
} }
] ]
}, },
@ -11311,7 +11334,7 @@
{ {
"name": "context", "name": "context",
"$ref": "ExecutionContextDescription", "$ref": "ExecutionContextDescription",
"description": "A newly created execution contex." "description": "A newly created execution context."
} }
], ],
"description": "Issued when new execution context is created." "description": "Issued when new execution context is created."
@ -11766,7 +11789,7 @@
"name": "end", "name": "end",
"$ref": "Location", "$ref": "Location",
"optional": true, "optional": true,
"description": "End of range to search possible breakpoint locations in (excluding). When not specifed, end of scripts is used as end of range." "description": "End of range to search possible breakpoint locations in (excluding). When not specified, end of scripts is used as end of range."
}, },
{ {
"name": "restrictToFunction", "name": "restrictToFunction",
@ -12753,7 +12776,7 @@
"description": "Profile title passed as an argument to console.profile()." "description": "Profile title passed as an argument to console.profile()."
} }
], ],
"description": "Sent when new profile recodring is started using console.profile() call." "description": "Sent when new profile recording is started using console.profile() call."
}, },
{ {
"name": "consoleProfileFinished", "name": "consoleProfileFinished",
@ -12977,7 +13000,7 @@
}, },
{ {
"name": "lastSeenObjectId", "name": "lastSeenObjectId",
"description": "If heap objects tracking has been started then backend regulary sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event.", "description": "If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event.",
"parameters": [ "parameters": [
{ {
"name": "lastSeenObjectId", "name": "lastSeenObjectId",

View File

@ -15,7 +15,7 @@ gometalinter \
--exclude='/easyjson\.go.*(passes|copies) lock' \ --exclude='/easyjson\.go.*(passes|copies) lock' \
--exclude='/easyjson\.go.*ineffectual assignment' \ --exclude='/easyjson\.go.*ineffectual assignment' \
--exclude='/easyjson\.go.*unnecessary conversion' \ --exclude='/easyjson\.go.*unnecessary conversion' \
--exclude='/easyjson\.go.*\((gocyclo|golint|goconst)\)$' \ --exclude='/easyjson\.go.*\((gocyclo|golint|goconst|staticcheck)\)$' \
--exclude='^cdp/.*Potential hardcoded credentials' \ --exclude='^cdp/.*Potential hardcoded credentials' \
--exclude='^cdp/cdp\.go.*UnmarshalEasyJSON.*\(gocyclo\)$' \ --exclude='^cdp/cdp\.go.*UnmarshalEasyJSON.*\(gocyclo\)$' \
--exclude='^cdp/cdputil/cdputil\.go.*UnmarshalMessage.*\(gocyclo\)$' \ --exclude='^cdp/cdputil/cdputil\.go.*UnmarshalMessage.*\(gocyclo\)$' \
@ -23,7 +23,7 @@ gometalinter \
--exclude='^cmd/chromedp-proxy/main\.go.*\(gas\)$' \ --exclude='^cmd/chromedp-proxy/main\.go.*\(gas\)$' \
--exclude='^cmd/chromedp-gen/fixup/fixup\.go.*\(goconst\)$' \ --exclude='^cmd/chromedp-gen/fixup/fixup\.go.*\(goconst\)$' \
--exclude='^cmd/chromedp-gen/internal/enum\.go.*unreachable' \ --exclude='^cmd/chromedp-gen/internal/enum\.go.*unreachable' \
--exclude='^cmd/chromedp-gen/main\.go.*\(gas\)$' \ --exclude='^cmd/chromedp-gen/(main|domain-gen)\.go.*\(gas\)$' \
--exclude='^kb/gen\.go.*\((gas|vet)\)$' \ --exclude='^kb/gen\.go.*\((gas|vet)\)$' \
--exclude='^runner/.*\(gas\)$' \ --exclude='^runner/.*\(gas\)$' \
--exclude='^handler\.go.*cmd can be easyjson\.Marshaler' \ --exclude='^handler\.go.*cmd can be easyjson\.Marshaler' \

View File

@ -640,12 +640,6 @@ func (h *TargetHandler) domEvent(ctxt context.Context, ev interface{}) {
case *dom.EventDistributedNodesUpdated: case *dom.EventDistributedNodesUpdated:
id, op = e.InsertionPointID, distributedNodesUpdated(e.DistributedNodes) id, op = e.InsertionPointID, distributedNodesUpdated(e.DistributedNodes)
case *dom.EventNodeHighlightRequested:
id, op = e.NodeID, nodeHighlightRequested
case *dom.EventInspectNodeRequested:
return
default: default:
h.errorf("unhandled node event %s", reflect.TypeOf(ev)) h.errorf("unhandled node event %s", reflect.TypeOf(ev))
return return

View File

@ -21,12 +21,13 @@ const (
) )
func TestMouseClickXY(t *testing.T) { func TestMouseClickXY(t *testing.T) {
var err error
t.Parallel() t.Parallel()
c := testAllocate(t, "input.html") c := testAllocate(t, "input.html")
defer c.Release() defer c.Release()
var err error
err = c.Run(defaultContext, Sleep(time.Millisecond*100)) err = c.Run(defaultContext, Sleep(time.Millisecond*100))
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)

View File

@ -12,9 +12,8 @@ func TestWaitReady(t *testing.T) {
c := testAllocate(t, "js.html") c := testAllocate(t, "js.html")
defer c.Release() defer c.Release()
var err error
var nodeIDs []cdp.NodeID var nodeIDs []cdp.NodeID
err = c.Run(defaultContext, NodeIDs("#input2", &nodeIDs, ByID)) err := c.Run(defaultContext, NodeIDs("#input2", &nodeIDs, ByID))
if err != nil { if err != nil {
t.Fatalf("got error: %v", err) t.Fatalf("got error: %v", err)
} }
@ -41,9 +40,8 @@ func TestWaitVisible(t *testing.T) {
c := testAllocate(t, "js.html") c := testAllocate(t, "js.html")
defer c.Release() defer c.Release()
var err error
var nodeIDs []cdp.NodeID var nodeIDs []cdp.NodeID
err = c.Run(defaultContext, NodeIDs("#input2", &nodeIDs, ByID)) err := c.Run(defaultContext, NodeIDs("#input2", &nodeIDs, ByID))
if err != nil { if err != nil {
t.Fatalf("got error: %v", err) t.Fatalf("got error: %v", err)
} }
@ -70,9 +68,8 @@ func TestWaitNotVisible(t *testing.T) {
c := testAllocate(t, "js.html") c := testAllocate(t, "js.html")
defer c.Release() defer c.Release()
var err error
var nodeIDs []cdp.NodeID var nodeIDs []cdp.NodeID
err = c.Run(defaultContext, NodeIDs("#input2", &nodeIDs, ByID)) err := c.Run(defaultContext, NodeIDs("#input2", &nodeIDs, ByID))
if err != nil { if err != nil {
t.Fatalf("got error: %v", err) t.Fatalf("got error: %v", err)
} }
@ -104,11 +101,9 @@ func TestWaitEnabled(t *testing.T) {
c := testAllocate(t, "js.html") c := testAllocate(t, "js.html")
defer c.Release() defer c.Release()
var err error
var attr string var attr string
ok := false var ok bool
err = c.Run(defaultContext, AttributeValue("#select1", "disabled", &attr, &ok, ByID)) err := c.Run(defaultContext, AttributeValue("#select1", "disabled", &attr, &ok, ByID))
if err != nil { if err != nil {
t.Fatalf("got error: %v", err) t.Fatalf("got error: %v", err)
} }
@ -155,9 +150,7 @@ func TestWaitSelected(t *testing.T) {
c := testAllocate(t, "js.html") c := testAllocate(t, "js.html")
defer c.Release() defer c.Release()
var err error err := c.Run(defaultContext, Click("#button3", ByID))
err = c.Run(defaultContext, Click("#button3", ByID))
if err != nil { if err != nil {
t.Fatalf("got error: %v", err) t.Fatalf("got error: %v", err)
} }
@ -202,9 +195,7 @@ func TestWaitNotPresent(t *testing.T) {
c := testAllocate(t, "js.html") c := testAllocate(t, "js.html")
defer c.Release() defer c.Release()
var err error err := c.Run(defaultContext, WaitVisible("#input3", ByID))
err = c.Run(defaultContext, WaitVisible("#input3", ByID))
if err != nil { if err != nil {
t.Fatalf("got error: %v", err) t.Fatalf("got error: %v", err)
} }
@ -226,9 +217,8 @@ func TestAtLeast(t *testing.T) {
c := testAllocate(t, "js.html") c := testAllocate(t, "js.html")
defer c.Release() defer c.Release()
var err error
var nodes []*cdp.Node var nodes []*cdp.Node
err = c.Run(defaultContext, Nodes("//input", &nodes, AtLeast(3))) err := c.Run(defaultContext, Nodes("//input", &nodes, AtLeast(3)))
if err != nil { if err != nil {
t.Fatalf("got error: %v", err) t.Fatalf("got error: %v", err)
} }

View File

@ -344,10 +344,6 @@ func distributedNodesUpdated(nodes []*cdp.BackendNode) nodeOp {
} }
} }
func nodeHighlightRequested(n *cdp.Node) {
// TODO
}
func insertNode(n []*cdp.Node, prevID cdp.NodeID, c *cdp.Node) []*cdp.Node { func insertNode(n []*cdp.Node, prevID cdp.NodeID, c *cdp.Node) []*cdp.Node {
var i int var i int
var found bool var found bool