← Back to DOM domain
DOM.getNodeForLocation
Returns node id at given location. Depending on whether DOM domain is enabled, nodeId is
either returned or not.
Domain: DOM
stable
Parameters
| Name | Type | Description |
x | integer | X coordinate. |
y | integer | Y coordinate. |
includeUserAgentShadowDOM (optional) | boolean | False to skip to the nearest non-UA shadow root ancestor (default: false). |
ignorePointerEventsNone (optional) | boolean | Whether to ignore pointer-events: none on elements and hit test them. |
Returns
| Name | Type | Description |
backendNodeId | BackendNodeId | Resulting node. |
frameId | Page.FrameId | Frame this node belongs to. |
nodeId | NodeId | Id of the node at given coordinates, only when enabled and requested document. |
Example Request
{
"id": 1,
"method": "DOM.getNodeForLocation",
"params": {
"x": 100,
"y": 100
}
}
Example Response
{
"id": 1,
"result": {
"backendNodeId": "backendNodeId-value",
"frameId": "ABC123DEF456",
"nodeId": 3
}
}
Usage in Node.js
const result = await send('DOM.getNodeForLocation', {"x": 100, "y": 100});
console.log(result);
// {"backendNodeId": "backendNodeId-value", "frameId": "ABC123DEF456", "nodeId": 3}