The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →To capture content that appears only after scrolling, scroll through the relevant page regions first, wait for the content you need to appear, and then call Playwright’s page.screenshot(path="page.png", full_page=True). The full_page option captures the page’s full scrollable extent; it does not, by itself, trigger or verify lazy loading.
Choose the screenshot method for the result you need
| Need | Python | What it captures |
|---|---|---|
| Visible viewport saved to a file | page.screenshot(path="page.png") |
The currently visible page area. |
| Full document saved to a file | page.screenshot(path="page.png", full_page=True) |
The full scrollable page, as if it were a very tall screen. |
| One matching element saved to a file | page.locator(".target").screenshot(path="target.png") |
The matching element; Playwright scrolls it into view first. |
| Screenshot bytes for processing in memory | image_bytes = page.screenshot() |
Image data returned by the screenshot call rather than saved to a file. |
For a whole page, use page.screenshot(..., full_page=True) after loading the required content. An element screenshot is useful for a particular region, but if that element is a scrollable container, its screenshot shows only the container’s currently scrolled portion.
As an Amazon Associate I earn from qualifying purchases.
Official references: Playwright Python screenshots and Playwright Python locator API.
Scroll to trigger lazy loading, then capture
This synchronous Python pattern scrolls through the document in viewport-sized increments, returns to the top, and takes a full-page screenshot. Replace the example URL and the locator with ones appropriate to the page. The example uses a short delay as a fallback; a page-specific readiness condition is more dependable where one is available.
#1 Best Overall
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page(viewport={"width": 1440, "height": 900})
page.goto("https://example.com")
# Wait for a meaningful page-specific landmark.
page.locator("main").wait_for(state="visible")
# Move through the document to trigger viewport-dependent loading.
page.evaluate("""async () => {
const step = Math.max(window.innerHeight, 500);
for (let y = 0; y < document.body.scrollHeight; y += step) {
window.scrollTo(0, y);
await new Promise(resolve => setTimeout(resolve, 200));
}
window.scrollTo(0, 0);
}""")
page.screenshot(path="page.png", full_page=True)
browser.close()
The 200 ms pause is illustrative, not a universal loading guarantee. Some pages need a longer wait; others do not need a fixed pause at all. When possible, wait for a known image, card, or other element that proves the relevant content has appeared before capturing. Playwright locator methods auto-wait for their documented conditions, but that does not mean every lazy-loaded image on a page is ready.
Verify images when they matter
If the page uses images as the key content, check the specific images you need rather than assuming that scrolling alone completed the work. For example, after scrolling to a target image, a page-specific check can wait for that image to be complete and have a nonzero natural width:
Rank #2
image = page.locator("img.product-photo").first
image.scroll_into_view_if_needed()
image.wait_for(state="visible")
page.wait_for_function("""selector => {
const img = document.querySelector(selector);
return img && img.complete && img.naturalWidth > 0;
}""", ".product-photo")
Adapt the selector and condition to the actual page: some sites replace placeholder elements, load images as CSS backgrounds, or render content in other ways. A successful wait for one image does not prove that all other images are ready.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesUse a deliberate stopping rule for changing pages
The sample loop reads document.body.scrollHeight as it advances, so it can include some content that expands the document during scrolling. It is not an unlimited crawler. Infinite-scroll pages, pages with nested scroll containers, or pages that append content after a delay require a stopping rule suited to the page—for example, a known final item, a “load more” control becoming unavailable, or a maximum scroll depth. Without a defined end, there is no natural boundary for a complete screenshot.
Capture an element or process the image in memory
For a specific element, use its locator’s screenshot method. The locator is scrolled into view before the capture:
page.locator(".article-content").screenshot(path="article-content.png")
This does not turn a scrollable element into a capture of all its internal content. To capture the full document, use the page-level screenshot with full_page=True. For programmatic processing, omit path and use the returned bytes:
image_bytes = page.screenshot(full_page=True)
The screenshot API also supports options for image format, clipping, and quality. Locator screenshots document an option to disable animations; finite animations are fast-forwarded and infinite animations are canceled to their initial state for the capture, then resumed. Consult the screenshot documentation and locator API reference for the option details relevant to your installed Playwright version.
Free tools Windows power users keep installed
One-click scans. No signup required.
Common problems and fixes
- The full-page image has blank image slots. Full-page capture controls output dimensions, not lazy-load behavior. Scroll the relevant regions into view, then wait for the page-specific image or content condition before taking the screenshot.
- The screenshot stops partway through a feed. An infinite or expanding page may not have a stable final height. Define what “complete” means, such as a specific final item or a maximum depth, and stop when that condition is met.
- A list of results changes while being captured.
locator.all()returns immediately; it does not wait for a dynamic list to finish loading. Wait for an explicit completion condition or stable, page-specific result before enumerating the locators. - The element screenshot shows only part of a panel. A locator screenshot of a scrollable container captures its currently scrolled content. Scroll within that container if you need another portion, or use a page-level full-page screenshot for the whole document.
- A fixed pause works inconsistently. Network and rendering time varies by page and run. Replace arbitrary timing with a locator or image-completion condition where possible; there is no single wait strategy that guarantees lazy loading on every site.
- The page has nested scrolling. Scrolling the window will not necessarily trigger content inside an independently scrollable panel. Identify that container and scroll it as well, then verify the target content before capture.
Or skip the browser setup
ScreenshotNeo provides a website screenshot API and MCP server. Its one-call API can return a screenshot or PDF; for this workflow, point it at the target URL and request the needed output settings. See the ScreenshotNeo API documentation.
Best Value
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
Before capture, ScreenshotNeo accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each of those steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers indicate the page verdict and billing status. Its MCP server offers take_screenshot, get_page_info, and capture_pdf for AI agents and MCP clients. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots.
Sign up free for 1,000 screenshots a month with no card.
Frequently Asked Questions
Does full_page=True make Playwright load every lazy image?
No. It captures the full scrollable page extent, but you must trigger and verify deferred content before taking the screenshot.
Can Playwright return a screenshot without writing a file?
Yes. Call page.screenshot() without a path argument to receive image bytes.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




