Skip to content

feat: screenshot element/region clipping (v0.3.7)#56

Merged
garrytan merged 3 commits intomainfrom
garrytan/ref-screenshot-fix
Mar 14, 2026
Merged

feat: screenshot element/region clipping (v0.3.7)#56
garrytan merged 3 commits intomainfrom
garrytan/ref-screenshot-fix

Conversation

@garrytan
Copy link
Owner

Summary

  • Screenshot element/region clippingscreenshot command now supports element crop via CSS selector or @ref (screenshot "#hero" out.png, screenshot @e3 out.png), region clip (screenshot --clip x,y,w,h out.png), and viewport-only mode (screenshot --viewport out.png). Uses Playwright's native locator.screenshot() and page.screenshot({ clip }). Full page remains the default.
  • 10 new tests covering all screenshot modes (viewport, CSS, @ref, clip) and error paths (unknown flag, mutual exclusion, invalid coords, path validation, nonexistent selector).

Pre-Landing Review

No issues found.

Test plan

  • All browse command tests pass (161 tests, 0 failures)
  • All snapshot tests pass (35 tests, 0 failures)
  • All skill validation + doc freshness tests pass (66 tests, 0 failures)

🤖 Generated with Claude Code

garrytan and others added 3 commits March 14, 2026 14:38
Add element crop (CSS selector or @ref), region clip (--clip x,y,w,h),
and viewport-only (--viewport) modes to the screenshot command. Uses
Playwright's native locator.screenshot() and page.screenshot({ clip }).
Full page remains the default. Includes 10 new tests covering all modes
and error paths.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@garrytan garrytan merged commit 2aa745c into main Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant