Conversation
… browser_vision Add selector parameter to browser_vision tool for capturing specific DOM elements instead of full viewport, matching agent-browser's element screenshot capability. - Add selector parameter to tool schema - Update browser_vision() function signature - Pass selector to agent-browser screenshot command (mutually exclusive with --full) Usage: browser_vision(question='...', selector='@e1') # element screenshot browser_vision(question='...') # full viewport (default)
12 tasks
teknium1
reviewed
Jul 12, 2026
teknium1
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for the focused element-capture proposal. The capability is still missing on current main: browser_vision exposes no selector at tools/browser_tool.py:1929-1945 and unconditionally appends --full at tools/browser_tool.py:4017-4022.
Problems
- The patch predates current backend routing.
browser_visiondispatches Camofox attools/browser_tool.py:3911-3913;camofox_visionaccepts no selector attools/browser_camofox.py:835-851, so Camofox would ignore the new parameter. - Lightpanda pre-routes capture through
_chrome_fallback_screenshotattools/browser_tool.py:3961-3968, before the normal screenshot argument construction. That fallback would likewise omit a selector. - No automated coverage is included. Existing command-argument tests live at
tests/tools/test_browser_console.py:294-344.
Suggested changes
- Port the change onto the current routing flow and share selector-aware screenshot arguments between the normal and Lightpanda fallback paths.
- Implement or explicitly reject selector capture for Camofox.
- Add tests for schema/registry forwarding and all supported backend paths.
Automated hermes-sweeper review.
| if annotate: | ||
| screenshot_args.append("--annotate") | ||
| screenshot_args.append("--full") | ||
| if selector: |
Collaborator
There was a problem hiding this comment.
Current main now has Camofox dispatch before this command construction (tools/browser_tool.py:3911) and a Lightpanda Chrome pre-route (tools/browser_tool.py:3961). Please carry selector behavior through both paths (or return an explicit unsupported-backend error for Camofox); otherwise this parameter silently captures the full page on those supported backends.
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
Add
selectorparameter tobrowser_visiontool for capturing specific DOM elements instead of full viewport, matching agent-browser's element screenshot capability.Background
The
browser_visiontool currently only supports full viewport screenshots (--full). However, agent-browser supports element-level screenshots via selector parameter, which is useful when you only need to capture a specific element (e.g., a modal, a tweet card, a form).Changes
selectorparameter to tool schemabrowser_vision()function signature--fullDocumentation Evidence
From agent-browser docs (https://www.mintlify.com/vercel-labs/agent-browser/commands/screenshots):
Selector is mutually exclusive with
--full— when selector is provided, it captures that element instead of full page.Test Results
Verified implementation with actual tests:
agent-browser screenshot @e1 test-element.pngagent-browser screenshot --full test-full.pngagent-browser screenshot --full @e1Test confirms selector and --full are mutually exclusive (selector takes precedence when provided).
Hermes Agent in-browser test:
✅ Success —截图保存到
/Users/hushicai/.hermes/cache/screenshots/browser_screenshot_58ffa11312014b118931a9ad1da2c940.pngUsage