Skip to content

fix: respect scan_full_page=False for viewport-only screenshots#1791

Open
Br1an67 wants to merge 1 commit intounclecode:mainfrom
Br1an67:fix/issue-1750-screenshot-viewport
Open

fix: respect scan_full_page=False for viewport-only screenshots#1791
Br1an67 wants to merge 1 commit intounclecode:mainfrom
Br1an67:fix/issue-1750-screenshot-viewport

Conversation

@Br1an67
Copy link

@Br1an67 Br1an67 commented Mar 1, 2026

Summary

Fixes #1750

When scan_full_page=False, take_screenshot() still produced a full-page stitched screenshot because page_need_scroll() always triggered take_screenshot_scroller for pages taller than the viewport. Now, when scan_full_page=False, take_screenshot() directly calls take_screenshot_naive() which captures only the viewport area at the configured resolution.

List of files changed and why

crawl4ai/async_crawler_strategy.py — Pass scan_full_page from config to take_screenshot(); skip scroll-based stitching when scan_full_page=False and return viewport-only screenshot.

How Has This Been Tested?

Verified the logic flow: with scan_full_page=False, take_screenshot() now returns early with take_screenshot_naive() which uses page.screenshot(full_page=False) — capturing exactly the viewport dimensions.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added/updated unit tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

When scan_full_page is False, take_screenshot now returns a viewport-only
screenshot via take_screenshot_naive instead of always stitching a
full-page image when the page exceeds the viewport height.

Closes unclecode#1750
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.

[Bug]: Screenshot size does not correspond Crawler and Browser settings

1 participant