#22782: fix(browser): respect fullPage option in screenshot captureBeyondViewport
size: XS
## Summary
Fixes viewport-only screenshots capturing the entire page because `captureBeyondViewport` was hardcoded to `true`.
## Problem
In `src/browser/cdp.ts`, the CDP `Page.captureScreenshot` call always uses `captureBeyondViewport: true`, ignoring the `fullPage` option. This means `fullPage: false` screenshots still capture content beyond the viewport.
## Fix
Changed `captureBeyondViewport: true` to `captureBeyondViewport: opts.fullPage ?? false`.
**1 file changed**, 1 line modified.
Fixes #17476
## Scope
Single line change in `src/browser/cdp.ts`.
## AI Assistance
Claude Code assisted with identifying the hardcoded parameter.
## Author
**Miloud Belarebia** — [@miloudbelarebia](https://github.com/miloudbelarebia)
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Fixed a bug where viewport-only screenshots (`fullPage: false`) were incorrectly capturing the entire page. The `captureScreenshot` function in `src/browser/cdp.ts:75` was hardcoded with `captureBeyondViewport: true`, which caused it to ignore the `fullPage` option. The fix changes this to `captureBeyondViewport: opts.fullPage ?? false`, ensuring that:
- When `fullPage: true` → captures beyond viewport with full page dimensions
- When `fullPage: false` or undefined → captures only the visible viewport
This is a minimal, targeted fix that directly addresses the root cause.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The change is a single-line fix that corrects a clear logic error where a hardcoded boolean value was preventing the `fullPage` option from working as intended. The fix properly respects the `fullPage` parameter using standard nullish coalescing, maintains backward compatibility (defaults to false when undefined), and aligns with the existing logic that sets clip regions based on `fullPage`. No new dependencies, no breaking changes, and addresses the reported issue #17476 directly.
- No files require special attention
<sub>Last reviewed commit: 5e59b43</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#11342: fix(browser): respect fullPage=false for viewport-only screenshots
by higginsvott · 2026-02-07
91.4%
#3895: perf: mathematical optimization of vision pipeline via deterministi...
by adarshsen592-create · 2026-01-29
69.1%
#14944: fix(browser): prefer openclaw profile in headless/noSandbox environ...
by BenediktSchackenberg · 2026-02-12
68.9%
#15595: fix(browser): avoid local port conflicts for remote cdp
by TsekaLuk · 2026-02-13
68.4%
#8303: fix(browser): enable downloads via CDP Browser.setDownloadBehavior
by gavinbmoore · 2026-02-03
67.6%
#9020: fix(browser): skip port ownership and WS reachability checks for re...
by yepack · 2026-02-04
67.3%
#17760: fix(browser): rewrite 0.0.0.0 and [::] wildcard addresses in CDP We...
by joeharouni · 2026-02-16
66.6%
#6686: fix: clear Playwright's default colorScheme override on CDP-connect...
by Terwox · 2026-02-01
66.5%
#18907: Fix: Improve browser error messages to avoid misleading agents
by jriff · 2026-02-17
65.5%
#20423: fix(web-fetch): cap htmlToMarkdown input size to prevent catastroph...
by Limitless2023 · 2026-02-18
64.8%