Overview
Query the DOM for elements matching a CSS selector. Results are cached for use with index-based operations in other commands (fill, click, get).Syntax
Arguments
CSS selector to match elements (e.g.,
".error", "#app", "button")Options
Output results as JSON
Output
Returns a compact summary with:- Total count of matched elements
- Element preview with nodeId, tag, classes, and text
- 0-based index for each element (use with other commands)
Human-readable format
JSON format
Examples
Find all buttons
Find elements by class
Find with complex selectors
Use cached results with other commands
Index-based operations
Query results are cached for the current page navigation. Use the 0-based index from query results with:bdg dom get <index>- Get element detailsbdg dom fill <index> <value>- Fill form fieldbdg dom click <index>- Click elementbdg dom a11y describe <index>- Get accessibility info
Exit codes
Success - elements found and cached
RESOURCE_NOT_FOUND - no elements match the selector
CDP_TIMEOUT - CDP operation timed out
Related commands
bdg dom get- Get element details using cached indexbdg dom fill- Fill form field using cached indexbdg dom click- Click element using cached index

