Open
Conversation
Adds `browse upload <selector> <files...>` to upload files to <input type="file"> elements. Uses Understudy's setInputFiles which handles both local (DOM.setFileInputFiles) and remote/Browserbase (base64 payload injection) paths. Supports single files, multiple files, and ref-based selectors from snapshot. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 25e6ea1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
There was a problem hiding this comment.
No issues found across 2 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Architecture diagram
sequenceDiagram
participant User
participant CLI as CLI (index.ts)
participant Locator as DeepLocator / Page
participant Understudy as Understudy (Service Layer)
participant Browser as Browser (Local/Remote)
Note over User,Browser: NEW: File Upload Flow
User->>CLI: browse upload <selector> <files...>
CLI->>CLI: resolveSelector(selector)
Note right of CLI: Handles @ref (snapshot) or CSS selectors
CLI->>Locator: NEW: setInputFiles(files)
Locator->>Understudy: setInputFiles(resolvedSelector, filePaths)
alt Local Session
Understudy->>Browser: CDP: DOM.setFileInputFiles
Note right of Browser: Uses local file paths directly
else Remote / Browserbase Session
Understudy->>Understudy: Read local files & encode to Base64
Understudy->>Browser: Inject Base64 payload via Protocol
end
Browser-->>Understudy: Success/Failure
Understudy-->>Locator: Result
Locator-->>CLI: { uploaded: true, files }
alt Success
CLI-->>User: Output JSON/Text result
else Error
CLI-->>User: console.error + process.exit(1)
end
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
browse upload <selector> <files...>command to upload files to<input type="file">elementssetInputFilesunder the hood, which handles both local (CDPDOM.setFileInputFiles) and remote/Browserbase (base64 payload injection) paths automaticallybrowse snapshot(e.g.,browse upload @0-5 ./doc.pdf)browse upload @0-5 ./a.png ./b.pngUsage
Test plan
<input type="file">🤖 Generated with Claude Code