Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk7 min

How to Capture a Long Webpage Screenshot in Selenium Without Stitching Errors

Use native full-document capture where supported; use controlled scroll-and-stitch only when the page needs scrolling to render, and inspect every join.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use the browser’s native full-document screenshot when your Selenium and browser combination supports it; it avoids stitching seams altogether. In Firefox, Selenium provides dedicated full-page screenshot methods. In Chromium, use Chrome DevTools Protocol (CDP) and explicitly enable capture beyond the viewport. WebDriver BiDi can target the full scrollable document where the deployed browser and binding support it. Fall back to scroll-and-stitch when the page must be scrolled to render its content, then check the finished image for repeated headers, gaps, and missing content.

Why a normal Selenium screenshot may show only the viewport

A standard WebDriver screenshot captures the current browsing context; it is not a cross-driver promise to capture the entire document. Selenium also supports screenshots of individual elements, which is a separate operation. Check the screenshot API and protocol your chosen browser driver actually supports rather than assuming a generic screenshot call expands to the page’s full height. Selenium: Take Screenshot

As an Amazon Associate I earn from qualifying purchases.

Choose a capture method for your browser and page

Method Best fit Important caveat
Firefox driver full-page screenshot Firefox automation using Selenium’s dedicated full-document methods. Use the Firefox driver API; do not assume the same methods exist for other drivers. Check the return value when saving to a file. Selenium Firefox WebDriver API
Chrome DevTools Protocol Chromium automation where you can issue CDP commands. Set captureBeyondViewport when capturing beyond the viewport. It defaults to false and is marked experimental in the protocol. Pin and validate the browser and driver versions you deploy. CDP Page.captureScreenshot
WebDriver BiDi A browser and Selenium binding that support document-origin screenshots. Support depends on the deployed stack; verify it on the actual browser and driver versions. WebDriver BiDi captureScreenshot
Scroll and stitch Pages that need scrolling to trigger rendering or cases where native capture is unsuitable. Requires controlled scrolling, waits, overlap, and visual inspection. WebdriverIO documents this approach for scroll-triggered content; that is a conceptual reference, not a Selenium built-in feature. WebdriverIO saveScreenshot

Capture a full page in Firefox with Selenium

The Firefox WebDriver API documents get_full_page_screenshot_as_file and get_full_page_screenshot_as_png. The example below uses the file method in Python and checks whether it reports success:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
from selenium import webdriver

options = webdriver.FirefoxOptions()
driver = webdriver.Firefox(options=options)
try:
    driver.get("https://example.com")
    saved = driver.get_full_page_screenshot_as_file("full-page.png")
    if not saved:
        raise RuntimeError("Firefox did not save the full-page screenshot")
finally:
    driver.quit()

Replace the example URL with the page you need. Wait for the page-specific content you need to capture before taking the screenshot. This method avoids manually assembling viewport strips, but the resulting image still needs checking for content that had not loaded yet.

#1 Best Overall

Capture beyond the viewport in Chromium with CDP

CDP’s Page.captureScreenshot accepts a clipping rectangle and a captureBeyondViewport option. The option defaults to false, so enable it for a clip extending beyond the visible viewport. Here is a Python example using Selenium’s CDP command interface and the current document dimensions:

from selenium import webdriver

options = webdriver.ChromeOptions()
driver = webdriver.Chrome(options=options)
try:
    driver.get("https://example.com")
    metrics = driver.execute_cdp_cmd("Page.getLayoutMetrics", {})
    size = metrics.get("cssContentSize") or metrics["contentSize"]
    width = size["width"]
    height = size["height"]

    result = driver.execute_cdp_cmd("Page.captureScreenshot", {
        "format": "png",
        "captureBeyondViewport": True,
        "clip": {
            "x": 0,
            "y": 0,
            "width": width,
            "height": height,
            "scale": 1
        }
    })

    import base64
    with open("full-page.png", "wb") as image_file:
        image_file.write(base64.b64decode(result["data"]))
finally:
    driver.quit()

This requests one image for the document dimensions reported by Chromium; it does not prove the page’s lazy content has rendered. CDP marks captureBeyondViewport experimental, so validate the command against the pinned browser and driver versions used in your project. Very tall pages may also encounter browser or image-processing limits; no universal maximum safe screenshot height is established here.

Rank #2
Dell Latitude 5420 14" FHD Business Laptop Computer, Intel Quad-Core i5-1145G7, 16GB DDR4 RAM, 256GB SSD, Camera, HDMI, Windows 11 Pro (Renewed)
  • 256 GB SSD of storage.
  • Multitasking is easy with 16GB of RAM
  • Equipped with a blazing fast Core i5 2.00 GHz processor.

Use WebDriver BiDi when document-origin capture is supported

WebDriver BiDi documents taking a screenshot with the origin set to document to include the full scrollable page. The command is protocol- and binding-dependent, so do not assume a particular Selenium method name or support level across versions. Confirm that your browser, driver, and Selenium binding expose the required BiDi command, then request document origin and validate the image on your deployed stack.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use scroll-and-stitch only when scrolling is needed

Native full-document capture is simpler when the page is already rendered and the browser supports it. Scrolling is useful when content appears only as it approaches the viewport, or when a native capture path is unsuitable. WebdriverIO describes a scroll-and-stitch workflow for this situation; Selenium users implementing the fallback must supply their own scrolling, waits, captures, and image assembly.

Rank #3
15.6 Inch Laptop Computer, N4020, 4GB DDR4 RAM, 128GB eMMC,with Windows 11
  • EFFORTLESS EVERYDAY PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 Home system, delivering reliable, low-power efficiency for daily tasks like document editing, email, online classes, and web browsing
  • 15.6-INCH FULL HD DISPLAY: Enjoy immersive visuals on the 15.6" FHD (1920x1080) anti-glare screen with micro-edge bezels. Delivers clear details and comfortable viewing for long study sessions, working on spreadsheets, and video playback
  • RESPONSIVE MULTITASKING & STORAGE: Built with 4GB LPDDR4 RAM and 128GB eMMC storage for smooth daily essential use. Expand your storage by up to 1TB via the integrated TF card slot to easily store movies, photos, and working files
  • ADVANCED CONNECTIVITY: Outfitted with 2x Full-Featured Type-C ports for data transfer, fast charging, and dual-monitor output, alongside 2x USB 3.2 Gen1 ports and a 3.5mm audio jack for complete peripheral compatibility
  • LIGHTWEIGHT & SILENT OPERATION: Slim and portable for effortless travel or commuting. Features a 1MP HD webcam for remote meetings, 38Wh battery with 45W Type-C fast charging, and a fanless silent design for peaceful work environments.
  1. Keep capture geometry fixed. Set the browser window to the intended viewport before starting. Do not change viewport width or device scale between strips: responsive reflow can shift text and elements, making otherwise correct strips fail to align.
  2. Trigger the content you need. Scroll through the relevant sections and wait for page-specific lazy images or other scroll-triggered content to load. A fixed delay may not be sufficient on every page; use a condition tied to the target page when possible.
  3. Capture overlapping strips. Scroll in controlled increments and retain a small overlap between adjacent viewport images. There is no universal overlap value: choose one appropriate to the viewport and content, then use it to align strips and detect duplicated or skipped rows.
  4. Handle fixed and sticky elements deliberately. A viewport-fixed header can appear in every strip. If you temporarily hide or modify an element to prevent duplication, target only the relevant page element, restore the original state afterward, and inspect that the change did not conceal page content. WebdriverIO documents hiding selected elements after the first scroll in its user-based full-page workflow; this is a reference for the strategy, not evidence of a Selenium built-in.
  5. Assemble and inspect the image. Align strips using their overlap. Check every join, the top and bottom edges, repeated headers, gaps, duplicate text, and lazy images or widgets that never appeared. Successful commands alone do not establish that the stitched result is correct.

Troubleshoot common capture failures

Symptom Likely cause What to check or change
The image stops at the visible viewport. A standard screenshot call captures the current browsing context, or CDP capture beyond the viewport was not enabled. Use the browser’s documented full-page method, a supported BiDi document-origin command, or CDP with captureBeyondViewport explicitly set to true.
CDP rejects the command or returns an incomplete image. The deployed browser/driver may not support the command or option as expected; the option is experimental. Check the protocol support for the exact versions in use, confirm the clip dimensions, and validate after upgrading or changing the stack.
Images or sections are missing. Content may load only after scrolling or after a page-specific event. Scroll through the relevant area, wait for its content to render, and capture after it is present. Inspect the finished image rather than relying on navigation completion alone.
Headers repeat or seams show duplicated text. Fixed or sticky elements appear in multiple strips, or strip alignment is off. Handle sticky elements deliberately and use the overlap to align strips. Recheck joins at full resolution.
Text jumps or strips do not align. Viewport width, scale, or responsive layout changed during capture. Keep the viewport and device scale consistent from the first strip to the last; rerun the capture if layout shifted.
The image looks plausible but may be incomplete. Successful capture does not guarantee all content rendered or all joins are clean. Verify dimensions and inspect top, bottom, lazy content, dynamic widgets, and every seam.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

For a screenshot API alternative, ScreenshotNeo returns a screenshot or PDF from one GET request. Cookie banners are accepted and more than 60 known consent platforms, newsletter popups, and chat widgets are removed before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server offers take_screenshot, get_page_info, and capture_pdf for AI agents.

cURL:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

Python:

import requests

r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://example.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://example.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

Replace YOUR_API_KEY and the target URL. See the ScreenshotNeo API documentation for request options. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for free.

Make the method decision page by page

Prefer a native full-document capture when the deployed browser supports it and scrolling is not required to render the page. Choose scroll-and-stitch when triggering viewport-dependent content is part of the task, and budget time to inspect every seam. Browser, driver, binding, viewport, and page behavior all affect the result; validate the exact combination you will run in production.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Quick Recap

Bestseller No. 1
HP 14' HD Laptop, Windows 11, Intel Celeron Dual-Core Processor Up to 2.60GHz, 4GB RAM, 64GB SSD, Webcam, Dale Pink (Renewed)
HP 14" HD Laptop, Windows 11, Intel Celeron Dual-Core Processor Up to 2.60GHz, 4GB RAM, 64GB SSD, Webcam, Dale Pink (Renewed)
14" diagonal, 1366x768 resolution, HD BrightView LED, Glossy NON-TOUCH Display
$245.99
Bestseller No. 2
Dell Latitude 5420 14' FHD Business Laptop Computer, Intel Quad-Core i5-1145G7, 16GB DDR4 RAM, 256GB SSD, Camera, HDMI, Windows 11 Pro (Renewed)
Dell Latitude 5420 14" FHD Business Laptop Computer, Intel Quad-Core i5-1145G7, 16GB DDR4 RAM, 256GB SSD, Camera, HDMI, Windows 11 Pro (Renewed)
256 GB SSD of storage.; Multitasking is easy with 16GB of RAM; Equipped with a blazing fast Core i5 2.00 GHz processor.
$285.00
Rank #4
15.6 Inch Win 11 Laptop Computer, N4020, 4GB DDR4 RAM, 128GB Storage
  • WINDOWS 11 | STABLE PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 system, this laptop delivers stable performance for everyday computing tasks. It supports web browsing, online learning, document editing, email communication, and basic office work with optimized power efficiency, providing a practical and reliable experience for essential daily use for daily use.
  • 15.6” FHD IPS DISPLAY: Features a 15.6-inch Full HD IPS display with narrow bezels, offering wider viewing angles and clearer image details compared to standard panels. The improved screen-to-body ratio enhances visual experience for study, reading, document work, and video playback, making it suitable for both productivity and entertainment use.
  • 4GB DDR4 + 128GB eMMC STORAGE: Equipped with 4GB DDR4 memory and 128GB eMMC storage for everyday basics such as browsing, documents, email, and online learning platforms. The built-in TF card slot supports storage expansion up to 1TB, giving you more flexibility for files, photos, videos, and daily documents. TF card not included.
  • CONNECTIVITY & PORTS: Includes 1× TF card slot, 2× USB 3.2 Gen1 ports, and 2× full-featured Type-C ports (USB 3.2 Gen1). The Type-C ports support data transfer, charging, and video output, enabling flexible connection with external devices such as monitors, storage, and peripherals for daily work and study use.
  • LIGHTWEIGHT DESIGN | ONLINE COMMUNICATION: Designed with a slim, portable profile, this laptop is easy to carry for school, commuting, and travel. A built-in 1MP front camera supports online classes, video meetings, remote communication, and everyday conferencing. The 3300mAh battery works with the low-power system design to support practical daily use, while thermal optimization helps maintain quieter operation during extended tasks.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.