DOM.scrollIntoViewIfNeededScrolls the specified rect of the given node into view if not already visible. Note: exactly one between nodeId, backendNodeId and objectId should be passed to identify the node.
| Name | Type | Description |
|---|---|---|
nodeId (optional) | NodeId | Identifier of the node. |
backendNodeId (optional) | BackendNodeId | Identifier of the backend node. |
objectId (optional) | Runtime.RemoteObjectId | JavaScript object id of the node wrapper. |
rect (optional) | Rect | The rect to be scrolled into view, relative to the node's border box, in CSS pixels. When omitted, center of the node will be used, similar to Element.scrollIntoView. |
{
"id": 1,
"method": "DOM.scrollIntoViewIfNeeded"
}
{
"id": 1,
"result": {}
}
const result = await send('DOM.scrollIntoViewIfNeeded');
console.log(result);