← Back to Overlay domain

Overlay.highlightRect

Highlights given rectangle. Coordinates are absolute with respect to the main frame viewport. Issue: the method does not handle device pixel ratio (DPR) correctly. The coordinates currently have to be adjusted by the client if DPR is not 1 (see crbug.com/437807128).

Domain: Overlay experimental

Parameters

NameTypeDescription
xintegerX coordinate
yintegerY coordinate
widthintegerRectangle width
heightintegerRectangle height
color (optional)DOM.RGBAThe highlight fill color (default: transparent).
outlineColor (optional)DOM.RGBAThe highlight outline color (default: transparent).

Example Request

{
  "id": 1,
  "method": "Overlay.highlightRect",
  "params": {
    "x": 100,
    "y": 100,
    "width": 1280,
    "height": 720
  }
}

Example Response

{
  "id": 1,
  "result": {}
}

Usage in Node.js

const result = await send('Overlay.highlightRect', {"x": 100, "y": 100, "width": 1280, "height": 720});
console.log(result);