← Back to DOM domain
DOM.getElementByRelation
Returns the NodeId of the matched element according to certain relations.
Domain: DOM
experimental
Parameters
| Name | Type | Description |
nodeId | NodeId | Id of the node from which to query the relation. |
relation | string | Type of relation to get. |
Returns
| Name | Type | Description |
nodeId | NodeId | NodeId of the element matching the queried relation. |
Example Request
{
"id": 1,
"method": "DOM.getElementByRelation",
"params": {
"nodeId": 1,
"relation": "relation-value"
}
}
Example Response
{
"id": 1,
"result": {
"nodeId": 3
}
}
Usage in Node.js
const result = await send('DOM.getElementByRelation', {"nodeId": 1, "relation": "relation-value"});
console.log(result);
// {"nodeId": 3}