Overview
Retrieve element information in two modes:- Semantic mode (default): 70-99% token reduction, returns
[Role] "Name" (properties)format ideal for AI agents - Raw mode (
--raw): Full HTML with attributes for debugging and inspection
Syntax
Arguments
CSS selector or numeric index from cached query results (0-based)
Options
Output raw HTML instead of semantic representation
Get all matching elements (only with
--raw)Get nth matching element, 0-based (only with
--raw)Use CDP nodeId directly (only with
--raw)Output as JSON
Output modes
Semantic mode (default)
Returns accessibility representation with role, name, and key properties:- Simple elements: 45-75% reduction
- Complex elements: 82-99% reduction
- No CSS classes or non-semantic attributes
Raw HTML mode
Returns complete HTML with all attributes:Examples
Get semantic representation
Get raw HTML
Use with cached query results
Semantic output format
Role text
- Heading levels:
[Heading L1],[Heading L2], etc. - Standard roles:
[Button],[Link],[Textbox], etc. - First letter capitalized
Context
- If accessible name exists:
"Name" - Fallback to DOM context:
<tag.class> "text preview"
Properties
focusable- Element can receive keyboard focusfocused- Element currently has focusdisabled- Element is disabledrequired- Field is required(inferred from DOM)- Role synthesized from HTML
Examples
When to use --raw
Use raw HTML mode when you need:
- Exact HTML structure with classes and attributes
- Multiple elements (
--all) - Specific element selection (
--nth,--node-id) - CSS/HTML debugging
- Data attributes or custom properties
- AI agent automation
- Token-efficient context
- Accessibility-first element identification
- Form field discovery
Exit codes
Success - element retrieved
RESOURCE_NOT_FOUND - element not found
STALE_CACHE - cached index invalid (page navigation)
CDP_TIMEOUT - CDP operation timed out
Related commands
bdg dom query- Find elements and cache resultsbdg dom a11y describe- Get detailed accessibility properties

