feat(browser): discover and drive nonstandard controls - #94
zzalancelot wants to merge 6 commits into
Conversation
7141dd0 to
00c2608
Compare
Whitelist-only snapshots missed div buttons, design-system date/select triggers, and overlay year/month cells; click() alone also failed to open mousedown/focus pickers. Add heuristics with depth, hidden forms, full pointer sequences, overlay leaves, selector/text addressing, and safer Enter. Harden review findings: keep full-document ids under region snapshots, require floating evidence for overlays, always mask CSS-hidden form values, surface invalid selectors as bad-args, and bound upload reads while accumulating short FileHandle.read returns until EOF.
00c2608 to
e62aa17
Compare
|
Thanks — I ran into this while working with a real Web Components / Shadow DOM page, then reproduced one remaining naming gap in an isolated fixture against this PR.
Both That breaks for controls inside an open shadow root: attribute ID references are In a representative fixture containing an open shadow root, with the label and a The inventory, indices and 60-item budget are otherwise identical, so this is a The small resolver I tested does three things:
The same resolver is used by both Tests cover:
The extension suite passes with the patch (422/422), along with typecheck and Scope note: this keeps the project's existing name model ( I did not change traversal, pointer heuristics, hiddenForms, Happy to send this as a small follow-up after this PR lands, or provide the patch |
…ol's tree Open shadow roots scope ID references and label associations; looking them up on document made shadowed controls fall back to their tag name.
8dcaa30 to
477e5ab
Compare
Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
Whitelist-only snapshots could not discover or drive design-system controls (div buttons, date/select triggers, overlay year/month cells). This change adds pointer heuristics with
depth, hidden form inventory, full pointer click sequences, overlay leaf discovery, selector/text addressing,browser_focus/browser_upload, and safer Enter handling while a floating panel is open.Evidence (ByteDance referral apply form):
maxInteractiveItemsdefault 60)browser_typeworks → gap was collection, not executiontext:"2024"/text:"01"Root causes
cursor:pointer/ rolesHTMLElement.click()alone skipsmousedown/focusopen pathsform.submitrisked submitting apply formsChanges
[heuristic]) with nesteddepth; filter common field-title labels; heuristic budget caphiddenFormsfor visually hidden but focusable inputs (readable; typeable)browser_click:index|selector|text; full pointerdown→mousedown→focus→mouseup→click sequenceoption "…" [overlay]inside panel/picker/dropdown rootsbrowser_focus,browser_upload(Host reads absolute path → base64)regionscopes main text and inventory; missing region errorsdepthCompatibility
browser_click/browser_typeindex usage unchanged0.1.5, bridge@yuxianglin/dsh-bridge-browser@0.0.6Test plan
pnpm --filter dsh-browser-extension run test(403)pnpm --filter @yuxianglin/dsh-bridge-browser run test(142)tests/fixtures/nonstandard-controls.htmltext:"2024"/text:"01"; confirm row shows concrete monthKnown limits
browser_pressis not real Tab focus / IMEThe PR appears safe to merge; no new actionable defects remain, and every previous thread is resolved.
Summary
This PR expands browser automation support for nonstandard design-system controls and addresses all previously reviewed issues.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR A[browser_snapshot] --> B[Visible controls] A --> C[Pointer heuristics] A --> D[Overlay leaves] A --> E[Masked hidden forms] B --> F[Stable element registry] C --> F D --> F E --> F F --> G[browser_click / type / focus / upload] H[Host file path] --> I[Bounded file read] I --> J[Base64 payload] J --> GReviews (3) · Last reviewed commit: "feat(browser): discover and drive nonsta..."