overlay.go 31 KB

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