Commit Graph
2 Commits
Author SHA1 Message Date
zhangyang-crazy-one 266afa7c34 fix(cdp): wrap role/name/value as CDP AXValue objects
Per qodo-ai-reviewer feedback on PR #44: Accessibility.getFullAXTree
was emitting AXNode.role as a plain string and name/value as plain
strings or null, instead of CDP-compliant AXValue objects.

Changes:
- Add ax_value_role() and ax_value_string() helpers
- Change compute_name()/compute_value() to return Option<String>
- Wrap role, name, value as AXValue in build_ax_node()

The properties array already used the correct AXValue format.
2026-04-27 20:59:47 +08:00
zhangyang-crazy-one a4591707e3 feat(cdp): implement Accessibility domain (getFullAXTree)
Implements the CDP Accessibility domain with getFullAXTree support,
enabling AI agent tools (agent-browser, Playwright MCP) that rely on
Accessibility.getFullAXTree to work with Obscura.

Changes:
- Add crates/obscura-cdp/src/domains/accessibility.rs (~380 lines)
  - Accessibility.enable: returns {}
  - Accessibility.getFullAXTree: walks DOM tree, produces AXNode array
  - Role mapping: 50+ HTML tags → ARIA roles, respects explicit role attr
  - Name computation: aria-label → aria-labelledby → alt → title → placeholder
  - Properties: focusable, editable, checked, disabled, level, required, multiline
- Update mod.rs: register accessibility module
- Update dispatch.rs: route Accessibility domain to real handler

Tested with example.com (18 nodes), httpbin.org/html (16 nodes),
news.ycombinator.com (1308 nodes). Zero structure errors.

Closes #12
2026-04-27 12:02:38 +08:00