[fix]: make file upload elements more explicit in page snapshot
Merged
SE
7mo ago+122+122+012345678901234567890123456789-2-2-0123456789
why
- file upload elements sometimes have a 'button' AX role
- this causes issues when users prompt
.observe()to find "file upload elements", since the model sees them as a 'button' - addresses #972
what changed
- this PR preserves the semantics of file upload elements by using the actual DOM tag name and 'type'
- eg, instead of
[0-12] button: Choose File, we now use[0-12] input, file: Choose File
test plan
- added a unit test for the replacement logic
- added an
observe()eval which checks that hidden file upload elements are correctly found by the LLM
Summary by cubic
Make file upload inputs explicit in the page snapshot so .observe() can reliably find them. Addresses Linear STG-934 by preventing file inputs from being misclassified as buttons.
- Bug Fixes
- Enrich DOM tag names to include input type (e.g.,
input, file) and use them in DOM maps. - Force file inputs to appear as
input, filein the a11y outline instead of AXbutton. - Add unit test and fix/register the
observe_file_uploadseval inevals.config.json. - Publish patch for
@browserbasehq/stagehand.
- Enrich DOM tag names to include input type (e.g.,