← Back to DOM domain
DOM.querySelector
Executes `querySelector` on a given node.
Domain: DOM
stable
Parameters
| Name | Type | Description |
nodeId | NodeId | Id of the node to query upon. |
selector | string | Selector string. |
Returns
| Name | Type | Description |
nodeId | NodeId | Query selector result. |
Example Request
{
"id": 1,
"method": "DOM.querySelector",
"params": {
"nodeId": 1,
"selector": "h1"
}
}
Example Response
{
"id": 1,
"result": {
"nodeId": 3
}
}
Usage in Node.js
const result = await send('DOM.querySelector', {"nodeId": 1, "selector": "h1"});
console.log(result);
// {"nodeId": 3}