← Back to DOM domain
DOM.performSearch
Searches for a given string in the DOM tree. Use `getSearchResults` to access search results or
`cancelSearch` to end this search session.
Domain: DOM
experimental
Parameters
| Name | Type | Description |
query | string | Plain text or query selector or XPath search query. |
includeUserAgentShadowDOM (optional) | boolean | True to search in user agent shadow DOM. |
Returns
| Name | Type | Description |
searchId | string | Unique search session identifier. |
resultCount | integer | Number of search results. |
Example Request
{
"id": 1,
"method": "DOM.performSearch",
"params": {
"query": "query-value"
}
}
Example Response
{
"id": 1,
"result": {
"searchId": "searchId-value",
"resultCount": 1
}
}
Usage in Node.js
const result = await send('DOM.performSearch', {"query": "query-value"});
console.log(result);
// {"searchId": "searchId-value", "resultCount": 1}