browser_query_selector
Query the DOM using CSS selectors or XPath to locate elements across all frames, returning their IDs, text, and bounding boxes for direct interaction.
Instructions
Query the DOM using a CSS selector or XPath and return matching elements with their backendNodeIds, text, and bounding boxes. Automatically searches across all frames (pierces iframes).
PREFER get_semantic_surface for page understanding. Use this tool only when you need to find elements by a specific CSS selector that the AX tree doesn't surface (e.g., elements with specific data-* attributes).
Returns backendNodeIds that can be used directly with atomic_interact.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"selector": "<selector>"
},
"name": "browser_query_selector"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | Yes | CSS selector or XPath (prefix with "xpath/") to query | |
| timeoutMs | No | Wait this many ms for the element to appear (default: 0 = instant check) | |
| visibleOnly | No | Only return visible elements (default: false) |