overlay.go 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853
  1. // Package overlay provides the Chrome DevTools Protocol
  2. // commands, types, and events for the Overlay domain.
  3. //
  4. // This domain provides various functionality related to drawing atop the
  5. // inspected page.
  6. //
  7. // Generated by the cdproto-gen command.
  8. package overlay
  9. // Code generated by cdproto-gen. DO NOT EDIT.
  10. import (
  11. "context"
  12. "github.com/chromedp/cdproto/cdp"
  13. "github.com/chromedp/cdproto/dom"
  14. "github.com/chromedp/cdproto/runtime"
  15. "github.com/mailru/easyjson"
  16. )
  17. // DisableParams disables domain notifications.
  18. type DisableParams struct{}
  19. // Disable disables domain notifications.
  20. //
  21. // See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-disable
  22. func Disable() *DisableParams {
  23. return &DisableParams{}
  24. }
  25. // Do executes Overlay.disable against the provided context.
  26. func (p *DisableParams) Do(ctx context.Context) (err error) {
  27. return cdp.Execute(ctx, CommandDisable, nil, nil)
  28. }
  29. // EnableParams enables domain notifications.
  30. type EnableParams struct{}
  31. // Enable enables domain notifications.
  32. //
  33. // See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-enable
  34. func Enable() *EnableParams {
  35. return &EnableParams{}
  36. }
  37. // Do executes Overlay.enable against the provided context.
  38. func (p *EnableParams) Do(ctx context.Context) (err error) {
  39. return cdp.Execute(ctx, CommandEnable, nil, nil)
  40. }
  41. // GetHighlightObjectForTestParams for testing.
  42. type GetHighlightObjectForTestParams struct {
  43. NodeID cdp.NodeID `json:"nodeId"` // Id of the node to get highlight object for.
  44. IncludeDistance bool `json:"includeDistance,omitempty"` // Whether to include distance info.
  45. IncludeStyle bool `json:"includeStyle,omitempty"` // Whether to include style info.
  46. ColorFormat ColorFormat `json:"colorFormat,omitempty"` // The color format to get config with (default: hex).
  47. ShowAccessibilityInfo bool `json:"showAccessibilityInfo,omitempty"` // Whether to show accessibility info (default: true).
  48. }
  49. // GetHighlightObjectForTest for testing.
  50. //
  51. // See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-getHighlightObjectForTest
  52. //
  53. // parameters:
  54. //
  55. // nodeID - Id of the node to get highlight object for.
  56. func GetHighlightObjectForTest(nodeID cdp.NodeID) *GetHighlightObjectForTestParams {
  57. return &GetHighlightObjectForTestParams{
  58. NodeID: nodeID,
  59. }
  60. }
  61. // WithIncludeDistance whether to include distance info.
  62. func (p GetHighlightObjectForTestParams) WithIncludeDistance(includeDistance bool) *GetHighlightObjectForTestParams {
  63. p.IncludeDistance = includeDistance
  64. return &p
  65. }
  66. // WithIncludeStyle whether to include style info.
  67. func (p GetHighlightObjectForTestParams) WithIncludeStyle(includeStyle bool) *GetHighlightObjectForTestParams {
  68. p.IncludeStyle = includeStyle
  69. return &p
  70. }
  71. // WithColorFormat the color format to get config with (default: hex).
  72. func (p GetHighlightObjectForTestParams) WithColorFormat(colorFormat ColorFormat) *GetHighlightObjectForTestParams {
  73. p.ColorFormat = colorFormat
  74. return &p
  75. }
  76. // WithShowAccessibilityInfo whether to show accessibility info (default:
  77. // true).
  78. func (p GetHighlightObjectForTestParams) WithShowAccessibilityInfo(showAccessibilityInfo bool) *GetHighlightObjectForTestParams {
  79. p.ShowAccessibilityInfo = showAccessibilityInfo
  80. return &p
  81. }
  82. // GetHighlightObjectForTestReturns return values.
  83. type GetHighlightObjectForTestReturns struct {
  84. Highlight easyjson.RawMessage `json:"highlight,omitempty"`
  85. }
  86. // Do executes Overlay.getHighlightObjectForTest against the provided context.
  87. //
  88. // returns:
  89. //
  90. // highlight - Highlight data for the node.
  91. func (p *GetHighlightObjectForTestParams) Do(ctx context.Context) (highlight easyjson.RawMessage, err error) {
  92. // execute
  93. var res GetHighlightObjectForTestReturns
  94. err = cdp.Execute(ctx, CommandGetHighlightObjectForTest, p, &res)
  95. if err != nil {
  96. return nil, err
  97. }
  98. return res.Highlight, nil
  99. }
  100. // GetGridHighlightObjectsForTestParams for Persistent Grid testing.
  101. type GetGridHighlightObjectsForTestParams struct {
  102. NodeIDs []cdp.NodeID `json:"nodeIds"` // Ids of the node to get highlight object for.
  103. }
  104. // GetGridHighlightObjectsForTest for Persistent Grid testing.
  105. //
  106. // See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-getGridHighlightObjectsForTest
  107. //
  108. // parameters:
  109. //
  110. // nodeIDs - Ids of the node to get highlight object for.
  111. func GetGridHighlightObjectsForTest(nodeIDs []cdp.NodeID) *GetGridHighlightObjectsForTestParams {
  112. return &GetGridHighlightObjectsForTestParams{
  113. NodeIDs: nodeIDs,
  114. }
  115. }
  116. // GetGridHighlightObjectsForTestReturns return values.
  117. type GetGridHighlightObjectsForTestReturns struct {
  118. Highlights easyjson.RawMessage `json:"highlights,omitempty"`
  119. }
  120. // Do executes Overlay.getGridHighlightObjectsForTest against the provided context.
  121. //
  122. // returns:
  123. //
  124. // highlights - Grid Highlight data for the node ids provided.
  125. func (p *GetGridHighlightObjectsForTestParams) Do(ctx context.Context) (highlights easyjson.RawMessage, err error) {
  126. // execute
  127. var res GetGridHighlightObjectsForTestReturns
  128. err = cdp.Execute(ctx, CommandGetGridHighlightObjectsForTest, p, &res)
  129. if err != nil {
  130. return nil, err
  131. }
  132. return res.Highlights, nil
  133. }
  134. // GetSourceOrderHighlightObjectForTestParams for Source Order Viewer
  135. // testing.
  136. type GetSourceOrderHighlightObjectForTestParams struct {
  137. NodeID cdp.NodeID `json:"nodeId"` // Id of the node to highlight.
  138. }
  139. // GetSourceOrderHighlightObjectForTest for Source Order Viewer testing.
  140. //
  141. // See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-getSourceOrderHighlightObjectForTest
  142. //
  143. // parameters:
  144. //
  145. // nodeID - Id of the node to highlight.
  146. func GetSourceOrderHighlightObjectForTest(nodeID cdp.NodeID) *GetSourceOrderHighlightObjectForTestParams {
  147. return &GetSourceOrderHighlightObjectForTestParams{
  148. NodeID: nodeID,
  149. }
  150. }
  151. // GetSourceOrderHighlightObjectForTestReturns return values.
  152. type GetSourceOrderHighlightObjectForTestReturns struct {
  153. Highlight easyjson.RawMessage `json:"highlight,omitempty"`
  154. }
  155. // Do executes Overlay.getSourceOrderHighlightObjectForTest against the provided context.
  156. //
  157. // returns:
  158. //
  159. // highlight - Source order highlight data for the node id provided.
  160. func (p *GetSourceOrderHighlightObjectForTestParams) Do(ctx context.Context) (highlight easyjson.RawMessage, err error) {
  161. // execute
  162. var res GetSourceOrderHighlightObjectForTestReturns
  163. err = cdp.Execute(ctx, CommandGetSourceOrderHighlightObjectForTest, p, &res)
  164. if err != nil {
  165. return nil, err
  166. }
  167. return res.Highlight, nil
  168. }
  169. // HideHighlightParams hides any highlight.
  170. type HideHighlightParams struct{}
  171. // HideHighlight hides any highlight.
  172. //
  173. // See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-hideHighlight
  174. func HideHighlight() *HideHighlightParams {
  175. return &HideHighlightParams{}
  176. }
  177. // Do executes Overlay.hideHighlight against the provided context.
  178. func (p *HideHighlightParams) Do(ctx context.Context) (err error) {
  179. return cdp.Execute(ctx, CommandHideHighlight, nil, nil)
  180. }
  181. // HighlightNodeParams highlights DOM node with given id or with the given
  182. // JavaScript object wrapper. Either nodeId or objectId must be specified.
  183. type HighlightNodeParams struct {
  184. HighlightConfig *HighlightConfig `json:"highlightConfig"` // A descriptor for the highlight appearance.
  185. NodeID cdp.NodeID `json:"nodeId,omitempty"` // Identifier of the node to highlight.
  186. BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty"` // Identifier of the backend node to highlight.
  187. ObjectID runtime.RemoteObjectID `json:"objectId,omitempty"` // JavaScript object id of the node to be highlighted.
  188. Selector string `json:"selector,omitempty"` // Selectors to highlight relevant nodes.
  189. }
  190. // HighlightNode highlights DOM node with given id or with the given
  191. // JavaScript object wrapper. Either nodeId or objectId must be specified.
  192. //
  193. // See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-highlightNode
  194. //
  195. // parameters:
  196. //
  197. // highlightConfig - A descriptor for the highlight appearance.
  198. func HighlightNode(highlightConfig *HighlightConfig) *HighlightNodeParams {
  199. return &HighlightNodeParams{
  200. HighlightConfig: highlightConfig,
  201. }
  202. }
  203. // WithNodeID identifier of the node to highlight.
  204. func (p HighlightNodeParams) WithNodeID(nodeID cdp.NodeID) *HighlightNodeParams {
  205. p.NodeID = nodeID
  206. return &p
  207. }
  208. // WithBackendNodeID identifier of the backend node to highlight.
  209. func (p HighlightNodeParams) WithBackendNodeID(backendNodeID cdp.BackendNodeID) *HighlightNodeParams {
  210. p.BackendNodeID = backendNodeID
  211. return &p
  212. }
  213. // WithObjectID JavaScript object id of the node to be highlighted.
  214. func (p HighlightNodeParams) WithObjectID(objectID runtime.RemoteObjectID) *HighlightNodeParams {
  215. p.ObjectID = objectID
  216. return &p
  217. }
  218. // WithSelector selectors to highlight relevant nodes.
  219. func (p HighlightNodeParams) WithSelector(selector string) *HighlightNodeParams {
  220. p.Selector = selector
  221. return &p
  222. }
  223. // Do executes Overlay.highlightNode against the provided context.
  224. func (p *HighlightNodeParams) Do(ctx context.Context) (err error) {
  225. return cdp.Execute(ctx, CommandHighlightNode, p, nil)
  226. }
  227. // HighlightQuadParams highlights given quad. Coordinates are absolute with
  228. // respect to the main frame viewport.
  229. type HighlightQuadParams struct {
  230. Quad dom.Quad `json:"quad"` // Quad to highlight
  231. Color *cdp.RGBA `json:"color,omitempty"` // The highlight fill color (default: transparent).
  232. OutlineColor *cdp.RGBA `json:"outlineColor,omitempty"` // The highlight outline color (default: transparent).
  233. }
  234. // HighlightQuad highlights given quad. Coordinates are absolute with respect
  235. // to the main frame viewport.
  236. //
  237. // See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-highlightQuad
  238. //
  239. // parameters:
  240. //
  241. // quad - Quad to highlight
  242. func HighlightQuad(quad dom.Quad) *HighlightQuadParams {
  243. return &HighlightQuadParams{
  244. Quad: quad,
  245. }
  246. }
  247. // WithColor the highlight fill color (default: transparent).
  248. func (p HighlightQuadParams) WithColor(color *cdp.RGBA) *HighlightQuadParams {
  249. p.Color = color
  250. return &p
  251. }
  252. // WithOutlineColor the highlight outline color (default: transparent).
  253. func (p HighlightQuadParams) WithOutlineColor(outlineColor *cdp.RGBA) *HighlightQuadParams {
  254. p.OutlineColor = outlineColor
  255. return &p
  256. }
  257. // Do executes Overlay.highlightQuad against the provided context.
  258. func (p *HighlightQuadParams) Do(ctx context.Context) (err error) {
  259. return cdp.Execute(ctx, CommandHighlightQuad, p, nil)
  260. }
  261. // HighlightRectParams highlights given rectangle. Coordinates are absolute
  262. // with respect to the main frame viewport.
  263. type HighlightRectParams struct {
  264. X int64 `json:"x"` // X coordinate
  265. Y int64 `json:"y"` // Y coordinate
  266. Width int64 `json:"width"` // Rectangle width
  267. Height int64 `json:"height"` // Rectangle height
  268. Color *cdp.RGBA `json:"color,omitempty"` // The highlight fill color (default: transparent).
  269. OutlineColor *cdp.RGBA `json:"outlineColor,omitempty"` // The highlight outline color (default: transparent).
  270. }
  271. // HighlightRect highlights given rectangle. Coordinates are absolute with
  272. // respect to the main frame viewport.
  273. //
  274. // See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-highlightRect
  275. //
  276. // parameters:
  277. //
  278. // x - X coordinate
  279. // y - Y coordinate
  280. // width - Rectangle width
  281. // height - Rectangle height
  282. func HighlightRect(x int64, y int64, width int64, height int64) *HighlightRectParams {
  283. return &HighlightRectParams{
  284. X: x,
  285. Y: y,
  286. Width: width,
  287. Height: height,
  288. }
  289. }
  290. // WithColor the highlight fill color (default: transparent).
  291. func (p HighlightRectParams) WithColor(color *cdp.RGBA) *HighlightRectParams {
  292. p.Color = color
  293. return &p
  294. }
  295. // WithOutlineColor the highlight outline color (default: transparent).
  296. func (p HighlightRectParams) WithOutlineColor(outlineColor *cdp.RGBA) *HighlightRectParams {
  297. p.OutlineColor = outlineColor
  298. return &p
  299. }
  300. // Do executes Overlay.highlightRect against the provided context.
  301. func (p *HighlightRectParams) Do(ctx context.Context) (err error) {
  302. return cdp.Execute(ctx, CommandHighlightRect, p, nil)
  303. }
  304. // HighlightSourceOrderParams highlights the source order of the children of
  305. // the DOM node with given id or with the given JavaScript object wrapper.
  306. // Either nodeId or objectId must be specified.
  307. type HighlightSourceOrderParams struct {
  308. SourceOrderConfig *SourceOrderConfig `json:"sourceOrderConfig"` // A descriptor for the appearance of the overlay drawing.
  309. NodeID cdp.NodeID `json:"nodeId,omitempty"` // Identifier of the node to highlight.
  310. BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty"` // Identifier of the backend node to highlight.
  311. ObjectID runtime.RemoteObjectID `json:"objectId,omitempty"` // JavaScript object id of the node to be highlighted.
  312. }
  313. // HighlightSourceOrder highlights the source order of the children of the
  314. // DOM node with given id or with the given JavaScript object wrapper. Either
  315. // nodeId or objectId must be specified.
  316. //
  317. // See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-highlightSourceOrder
  318. //
  319. // parameters:
  320. //
  321. // sourceOrderConfig - A descriptor for the appearance of the overlay drawing.
  322. func HighlightSourceOrder(sourceOrderConfig *SourceOrderConfig) *HighlightSourceOrderParams {
  323. return &HighlightSourceOrderParams{
  324. SourceOrderConfig: sourceOrderConfig,
  325. }
  326. }
  327. // WithNodeID identifier of the node to highlight.
  328. func (p HighlightSourceOrderParams) WithNodeID(nodeID cdp.NodeID) *HighlightSourceOrderParams {
  329. p.NodeID = nodeID
  330. return &p
  331. }
  332. // WithBackendNodeID identifier of the backend node to highlight.
  333. func (p HighlightSourceOrderParams) WithBackendNodeID(backendNodeID cdp.BackendNodeID) *HighlightSourceOrderParams {
  334. p.BackendNodeID = backendNodeID
  335. return &p
  336. }
  337. // WithObjectID JavaScript object id of the node to be highlighted.
  338. func (p HighlightSourceOrderParams) WithObjectID(objectID runtime.RemoteObjectID) *HighlightSourceOrderParams {
  339. p.ObjectID = objectID
  340. return &p
  341. }
  342. // Do executes Overlay.highlightSourceOrder against the provided context.
  343. func (p *HighlightSourceOrderParams) Do(ctx context.Context) (err error) {
  344. return cdp.Execute(ctx, CommandHighlightSourceOrder, p, nil)
  345. }
  346. // SetInspectModeParams enters the 'inspect' mode. In this mode, elements
  347. // that user is hovering over are highlighted. Backend then generates
  348. // 'inspectNodeRequested' event upon element selection.
  349. type SetInspectModeParams struct {
  350. Mode InspectMode `json:"mode"` // Set an inspection mode.
  351. HighlightConfig *HighlightConfig `json:"highlightConfig,omitempty"` // A descriptor for the highlight appearance of hovered-over nodes. May be omitted if enabled == false.
  352. }
  353. // SetInspectMode enters the 'inspect' mode. In this mode, elements that user
  354. // is hovering over are highlighted. Backend then generates
  355. // 'inspectNodeRequested' event upon element selection.
  356. //
  357. // See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-setInspectMode
  358. //
  359. // parameters:
  360. //
  361. // mode - Set an inspection mode.
  362. func SetInspectMode(mode InspectMode) *SetInspectModeParams {
  363. return &SetInspectModeParams{
  364. Mode: mode,
  365. }
  366. }
  367. // WithHighlightConfig a descriptor for the highlight appearance of
  368. // hovered-over nodes. May be omitted if enabled == false.
  369. func (p SetInspectModeParams) WithHighlightConfig(highlightConfig *HighlightConfig) *SetInspectModeParams {
  370. p.HighlightConfig = highlightConfig
  371. return &p
  372. }
  373. // Do executes Overlay.setInspectMode against the provided context.
  374. func (p *SetInspectModeParams) Do(ctx context.Context) (err error) {
  375. return cdp.Execute(ctx, CommandSetInspectMode, p, nil)
  376. }
  377. // SetShowAdHighlightsParams highlights owner element of all frames detected
  378. // to be ads.
  379. type SetShowAdHighlightsParams struct {
  380. Show bool `json:"show"` // True for showing ad highlights
  381. }
  382. // SetShowAdHighlights highlights owner element of all frames detected to be
  383. // ads.
  384. //
  385. // See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-setShowAdHighlights
  386. //
  387. // parameters:
  388. //
  389. // show - True for showing ad highlights
  390. func SetShowAdHighlights(show bool) *SetShowAdHighlightsParams {
  391. return &SetShowAdHighlightsParams{
  392. Show: show,
  393. }
  394. }
  395. // Do executes Overlay.setShowAdHighlights against the provided context.
  396. func (p *SetShowAdHighlightsParams) Do(ctx context.Context) (err error) {
  397. return cdp.Execute(ctx, CommandSetShowAdHighlights, p, nil)
  398. }
  399. // SetPausedInDebuggerMessageParams [no description].
  400. type SetPausedInDebuggerMessageParams struct {
  401. Message string `json:"message,omitempty"` // The message to display, also triggers resume and step over controls.
  402. }
  403. // SetPausedInDebuggerMessage [no description].
  404. //
  405. // See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-setPausedInDebuggerMessage
  406. //
  407. // parameters:
  408. func SetPausedInDebuggerMessage() *SetPausedInDebuggerMessageParams {
  409. return &SetPausedInDebuggerMessageParams{}
  410. }
  411. // WithMessage the message to display, also triggers resume and step over
  412. // controls.
  413. func (p SetPausedInDebuggerMessageParams) WithMessage(message string) *SetPausedInDebuggerMessageParams {
  414. p.Message = message
  415. return &p
  416. }
  417. // Do executes Overlay.setPausedInDebuggerMessage against the provided context.
  418. func (p *SetPausedInDebuggerMessageParams) Do(ctx context.Context) (err error) {
  419. return cdp.Execute(ctx, CommandSetPausedInDebuggerMessage, p, nil)
  420. }
  421. // SetShowDebugBordersParams requests that backend shows debug borders on
  422. // layers.
  423. type SetShowDebugBordersParams struct {
  424. Show bool `json:"show"` // True for showing debug borders
  425. }
  426. // SetShowDebugBorders requests that backend shows debug borders on layers.
  427. //
  428. // See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-setShowDebugBorders
  429. //
  430. // parameters:
  431. //
  432. // show - True for showing debug borders
  433. func SetShowDebugBorders(show bool) *SetShowDebugBordersParams {
  434. return &SetShowDebugBordersParams{
  435. Show: show,
  436. }
  437. }
  438. // Do executes Overlay.setShowDebugBorders against the provided context.
  439. func (p *SetShowDebugBordersParams) Do(ctx context.Context) (err error) {
  440. return cdp.Execute(ctx, CommandSetShowDebugBorders, p, nil)
  441. }
  442. // SetShowFPSCounterParams requests that backend shows the FPS counter.
  443. type SetShowFPSCounterParams struct {
  444. Show bool `json:"show"` // True for showing the FPS counter
  445. }
  446. // SetShowFPSCounter requests that backend shows the FPS counter.
  447. //
  448. // See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-setShowFPSCounter
  449. //
  450. // parameters:
  451. //
  452. // show - True for showing the FPS counter
  453. func SetShowFPSCounter(show bool) *SetShowFPSCounterParams {
  454. return &SetShowFPSCounterParams{
  455. Show: show,
  456. }
  457. }
  458. // Do executes Overlay.setShowFPSCounter against the provided context.
  459. func (p *SetShowFPSCounterParams) Do(ctx context.Context) (err error) {
  460. return cdp.Execute(ctx, CommandSetShowFPSCounter, p, nil)
  461. }
  462. // SetShowGridOverlaysParams highlight multiple elements with the CSS Grid
  463. // overlay.
  464. type SetShowGridOverlaysParams struct {
  465. GridNodeHighlightConfigs []*GridNodeHighlightConfig `json:"gridNodeHighlightConfigs"` // An array of node identifiers and descriptors for the highlight appearance.
  466. }
  467. // SetShowGridOverlays highlight multiple elements with the CSS Grid overlay.
  468. //
  469. // See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-setShowGridOverlays
  470. //
  471. // parameters:
  472. //
  473. // gridNodeHighlightConfigs - An array of node identifiers and descriptors for the highlight appearance.
  474. func SetShowGridOverlays(gridNodeHighlightConfigs []*GridNodeHighlightConfig) *SetShowGridOverlaysParams {
  475. return &SetShowGridOverlaysParams{
  476. GridNodeHighlightConfigs: gridNodeHighlightConfigs,
  477. }
  478. }
  479. // Do executes Overlay.setShowGridOverlays against the provided context.
  480. func (p *SetShowGridOverlaysParams) Do(ctx context.Context) (err error) {
  481. return cdp.Execute(ctx, CommandSetShowGridOverlays, p, nil)
  482. }
  483. // SetShowFlexOverlaysParams [no description].
  484. type SetShowFlexOverlaysParams struct {
  485. FlexNodeHighlightConfigs []*FlexNodeHighlightConfig `json:"flexNodeHighlightConfigs"` // An array of node identifiers and descriptors for the highlight appearance.
  486. }
  487. // SetShowFlexOverlays [no description].
  488. //
  489. // See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-setShowFlexOverlays
  490. //
  491. // parameters:
  492. //
  493. // flexNodeHighlightConfigs - An array of node identifiers and descriptors for the highlight appearance.
  494. func SetShowFlexOverlays(flexNodeHighlightConfigs []*FlexNodeHighlightConfig) *SetShowFlexOverlaysParams {
  495. return &SetShowFlexOverlaysParams{
  496. FlexNodeHighlightConfigs: flexNodeHighlightConfigs,
  497. }
  498. }
  499. // Do executes Overlay.setShowFlexOverlays against the provided context.
  500. func (p *SetShowFlexOverlaysParams) Do(ctx context.Context) (err error) {
  501. return cdp.Execute(ctx, CommandSetShowFlexOverlays, p, nil)
  502. }
  503. // SetShowScrollSnapOverlaysParams [no description].
  504. type SetShowScrollSnapOverlaysParams struct {
  505. ScrollSnapHighlightConfigs []*ScrollSnapHighlightConfig `json:"scrollSnapHighlightConfigs"` // An array of node identifiers and descriptors for the highlight appearance.
  506. }
  507. // SetShowScrollSnapOverlays [no description].
  508. //
  509. // See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-setShowScrollSnapOverlays
  510. //
  511. // parameters:
  512. //
  513. // scrollSnapHighlightConfigs - An array of node identifiers and descriptors for the highlight appearance.
  514. func SetShowScrollSnapOverlays(scrollSnapHighlightConfigs []*ScrollSnapHighlightConfig) *SetShowScrollSnapOverlaysParams {
  515. return &SetShowScrollSnapOverlaysParams{
  516. ScrollSnapHighlightConfigs: scrollSnapHighlightConfigs,
  517. }
  518. }
  519. // Do executes Overlay.setShowScrollSnapOverlays against the provided context.
  520. func (p *SetShowScrollSnapOverlaysParams) Do(ctx context.Context) (err error) {
  521. return cdp.Execute(ctx, CommandSetShowScrollSnapOverlays, p, nil)
  522. }
  523. // SetShowContainerQueryOverlaysParams [no description].
  524. type SetShowContainerQueryOverlaysParams struct {
  525. ContainerQueryHighlightConfigs []*ContainerQueryHighlightConfig `json:"containerQueryHighlightConfigs"` // An array of node identifiers and descriptors for the highlight appearance.
  526. }
  527. // SetShowContainerQueryOverlays [no description].
  528. //
  529. // See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-setShowContainerQueryOverlays
  530. //
  531. // parameters:
  532. //
  533. // containerQueryHighlightConfigs - An array of node identifiers and descriptors for the highlight appearance.
  534. func SetShowContainerQueryOverlays(containerQueryHighlightConfigs []*ContainerQueryHighlightConfig) *SetShowContainerQueryOverlaysParams {
  535. return &SetShowContainerQueryOverlaysParams{
  536. ContainerQueryHighlightConfigs: containerQueryHighlightConfigs,
  537. }
  538. }
  539. // Do executes Overlay.setShowContainerQueryOverlays against the provided context.
  540. func (p *SetShowContainerQueryOverlaysParams) Do(ctx context.Context) (err error) {
  541. return cdp.Execute(ctx, CommandSetShowContainerQueryOverlays, p, nil)
  542. }
  543. // SetShowPaintRectsParams requests that backend shows paint rectangles.
  544. type SetShowPaintRectsParams struct {
  545. Result bool `json:"result"` // True for showing paint rectangles
  546. }
  547. // SetShowPaintRects requests that backend shows paint rectangles.
  548. //
  549. // See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-setShowPaintRects
  550. //
  551. // parameters:
  552. //
  553. // result - True for showing paint rectangles
  554. func SetShowPaintRects(result bool) *SetShowPaintRectsParams {
  555. return &SetShowPaintRectsParams{
  556. Result: result,
  557. }
  558. }
  559. // Do executes Overlay.setShowPaintRects against the provided context.
  560. func (p *SetShowPaintRectsParams) Do(ctx context.Context) (err error) {
  561. return cdp.Execute(ctx, CommandSetShowPaintRects, p, nil)
  562. }
  563. // SetShowLayoutShiftRegionsParams requests that backend shows layout shift
  564. // regions.
  565. type SetShowLayoutShiftRegionsParams struct {
  566. Result bool `json:"result"` // True for showing layout shift regions
  567. }
  568. // SetShowLayoutShiftRegions requests that backend shows layout shift
  569. // regions.
  570. //
  571. // See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-setShowLayoutShiftRegions
  572. //
  573. // parameters:
  574. //
  575. // result - True for showing layout shift regions
  576. func SetShowLayoutShiftRegions(result bool) *SetShowLayoutShiftRegionsParams {
  577. return &SetShowLayoutShiftRegionsParams{
  578. Result: result,
  579. }
  580. }
  581. // Do executes Overlay.setShowLayoutShiftRegions against the provided context.
  582. func (p *SetShowLayoutShiftRegionsParams) Do(ctx context.Context) (err error) {
  583. return cdp.Execute(ctx, CommandSetShowLayoutShiftRegions, p, nil)
  584. }
  585. // SetShowScrollBottleneckRectsParams requests that backend shows scroll
  586. // bottleneck rects.
  587. type SetShowScrollBottleneckRectsParams struct {
  588. Show bool `json:"show"` // True for showing scroll bottleneck rects
  589. }
  590. // SetShowScrollBottleneckRects requests that backend shows scroll bottleneck
  591. // rects.
  592. //
  593. // See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-setShowScrollBottleneckRects
  594. //
  595. // parameters:
  596. //
  597. // show - True for showing scroll bottleneck rects
  598. func SetShowScrollBottleneckRects(show bool) *SetShowScrollBottleneckRectsParams {
  599. return &SetShowScrollBottleneckRectsParams{
  600. Show: show,
  601. }
  602. }
  603. // Do executes Overlay.setShowScrollBottleneckRects against the provided context.
  604. func (p *SetShowScrollBottleneckRectsParams) Do(ctx context.Context) (err error) {
  605. return cdp.Execute(ctx, CommandSetShowScrollBottleneckRects, p, nil)
  606. }
  607. // SetShowWebVitalsParams request that backend shows an overlay with web
  608. // vital metrics.
  609. type SetShowWebVitalsParams struct {
  610. Show bool `json:"show"`
  611. }
  612. // SetShowWebVitals request that backend shows an overlay with web vital
  613. // metrics.
  614. //
  615. // See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-setShowWebVitals
  616. //
  617. // parameters:
  618. //
  619. // show
  620. func SetShowWebVitals(show bool) *SetShowWebVitalsParams {
  621. return &SetShowWebVitalsParams{
  622. Show: show,
  623. }
  624. }
  625. // Do executes Overlay.setShowWebVitals against the provided context.
  626. func (p *SetShowWebVitalsParams) Do(ctx context.Context) (err error) {
  627. return cdp.Execute(ctx, CommandSetShowWebVitals, p, nil)
  628. }
  629. // SetShowViewportSizeOnResizeParams paints viewport size upon main frame
  630. // resize.
  631. type SetShowViewportSizeOnResizeParams struct {
  632. Show bool `json:"show"` // Whether to paint size or not.
  633. }
  634. // SetShowViewportSizeOnResize paints viewport size upon main frame resize.
  635. //
  636. // See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-setShowViewportSizeOnResize
  637. //
  638. // parameters:
  639. //
  640. // show - Whether to paint size or not.
  641. func SetShowViewportSizeOnResize(show bool) *SetShowViewportSizeOnResizeParams {
  642. return &SetShowViewportSizeOnResizeParams{
  643. Show: show,
  644. }
  645. }
  646. // Do executes Overlay.setShowViewportSizeOnResize against the provided context.
  647. func (p *SetShowViewportSizeOnResizeParams) Do(ctx context.Context) (err error) {
  648. return cdp.Execute(ctx, CommandSetShowViewportSizeOnResize, p, nil)
  649. }
  650. // SetShowHingeParams add a dual screen device hinge.
  651. type SetShowHingeParams struct {
  652. HingeConfig *HingeConfig `json:"hingeConfig,omitempty"` // hinge data, null means hideHinge
  653. }
  654. // SetShowHinge add a dual screen device hinge.
  655. //
  656. // See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-setShowHinge
  657. //
  658. // parameters:
  659. func SetShowHinge() *SetShowHingeParams {
  660. return &SetShowHingeParams{}
  661. }
  662. // WithHingeConfig hinge data, null means hideHinge.
  663. func (p SetShowHingeParams) WithHingeConfig(hingeConfig *HingeConfig) *SetShowHingeParams {
  664. p.HingeConfig = hingeConfig
  665. return &p
  666. }
  667. // Do executes Overlay.setShowHinge against the provided context.
  668. func (p *SetShowHingeParams) Do(ctx context.Context) (err error) {
  669. return cdp.Execute(ctx, CommandSetShowHinge, p, nil)
  670. }
  671. // SetShowIsolatedElementsParams show elements in isolation mode with
  672. // overlays.
  673. type SetShowIsolatedElementsParams struct {
  674. IsolatedElementHighlightConfigs []*IsolatedElementHighlightConfig `json:"isolatedElementHighlightConfigs"` // An array of node identifiers and descriptors for the highlight appearance.
  675. }
  676. // SetShowIsolatedElements show elements in isolation mode with overlays.
  677. //
  678. // See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-setShowIsolatedElements
  679. //
  680. // parameters:
  681. //
  682. // isolatedElementHighlightConfigs - An array of node identifiers and descriptors for the highlight appearance.
  683. func SetShowIsolatedElements(isolatedElementHighlightConfigs []*IsolatedElementHighlightConfig) *SetShowIsolatedElementsParams {
  684. return &SetShowIsolatedElementsParams{
  685. IsolatedElementHighlightConfigs: isolatedElementHighlightConfigs,
  686. }
  687. }
  688. // Do executes Overlay.setShowIsolatedElements against the provided context.
  689. func (p *SetShowIsolatedElementsParams) Do(ctx context.Context) (err error) {
  690. return cdp.Execute(ctx, CommandSetShowIsolatedElements, p, nil)
  691. }
  692. // SetShowWindowControlsOverlayParams show Window Controls Overlay for PWA.
  693. type SetShowWindowControlsOverlayParams struct {
  694. WindowControlsOverlayConfig *WindowControlsOverlayConfig `json:"windowControlsOverlayConfig,omitempty"` // Window Controls Overlay data, null means hide Window Controls Overlay
  695. }
  696. // SetShowWindowControlsOverlay show Window Controls Overlay for PWA.
  697. //
  698. // See: https://chromedevtools.github.io/devtools-protocol/tot/Overlay#method-setShowWindowControlsOverlay
  699. //
  700. // parameters:
  701. func SetShowWindowControlsOverlay() *SetShowWindowControlsOverlayParams {
  702. return &SetShowWindowControlsOverlayParams{}
  703. }
  704. // WithWindowControlsOverlayConfig window Controls Overlay data, null means
  705. // hide Window Controls Overlay.
  706. func (p SetShowWindowControlsOverlayParams) WithWindowControlsOverlayConfig(windowControlsOverlayConfig *WindowControlsOverlayConfig) *SetShowWindowControlsOverlayParams {
  707. p.WindowControlsOverlayConfig = windowControlsOverlayConfig
  708. return &p
  709. }
  710. // Do executes Overlay.setShowWindowControlsOverlay against the provided context.
  711. func (p *SetShowWindowControlsOverlayParams) Do(ctx context.Context) (err error) {
  712. return cdp.Execute(ctx, CommandSetShowWindowControlsOverlay, p, nil)
  713. }
  714. // Command names.
  715. const (
  716. CommandDisable = "Overlay.disable"
  717. CommandEnable = "Overlay.enable"
  718. CommandGetHighlightObjectForTest = "Overlay.getHighlightObjectForTest"
  719. CommandGetGridHighlightObjectsForTest = "Overlay.getGridHighlightObjectsForTest"
  720. CommandGetSourceOrderHighlightObjectForTest = "Overlay.getSourceOrderHighlightObjectForTest"
  721. CommandHideHighlight = "Overlay.hideHighlight"
  722. CommandHighlightNode = "Overlay.highlightNode"
  723. CommandHighlightQuad = "Overlay.highlightQuad"
  724. CommandHighlightRect = "Overlay.highlightRect"
  725. CommandHighlightSourceOrder = "Overlay.highlightSourceOrder"
  726. CommandSetInspectMode = "Overlay.setInspectMode"
  727. CommandSetShowAdHighlights = "Overlay.setShowAdHighlights"
  728. CommandSetPausedInDebuggerMessage = "Overlay.setPausedInDebuggerMessage"
  729. CommandSetShowDebugBorders = "Overlay.setShowDebugBorders"
  730. CommandSetShowFPSCounter = "Overlay.setShowFPSCounter"
  731. CommandSetShowGridOverlays = "Overlay.setShowGridOverlays"
  732. CommandSetShowFlexOverlays = "Overlay.setShowFlexOverlays"
  733. CommandSetShowScrollSnapOverlays = "Overlay.setShowScrollSnapOverlays"
  734. CommandSetShowContainerQueryOverlays = "Overlay.setShowContainerQueryOverlays"
  735. CommandSetShowPaintRects = "Overlay.setShowPaintRects"
  736. CommandSetShowLayoutShiftRegions = "Overlay.setShowLayoutShiftRegions"
  737. CommandSetShowScrollBottleneckRects = "Overlay.setShowScrollBottleneckRects"
  738. CommandSetShowWebVitals = "Overlay.setShowWebVitals"
  739. CommandSetShowViewportSizeOnResize = "Overlay.setShowViewportSizeOnResize"
  740. CommandSetShowHinge = "Overlay.setShowHinge"
  741. CommandSetShowIsolatedElements = "Overlay.setShowIsolatedElements"
  742. CommandSetShowWindowControlsOverlay = "Overlay.setShowWindowControlsOverlay"
  743. )