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 DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk6 min

Best Selenium Libraries for Full-Page Screenshots in Python

For full-page Selenium screenshots, Firefox offers a direct WebDriver API; Chrome and Chromium need browser-specific CDP code. Here’s how to choose and implement each route.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For Firefox, use Selenium’s built-in full-document screenshot methods: get_full_page_screenshot_as_file() or save_full_page_screenshot(). For Chrome or Chromium, Selenium’s ordinary screenshot call captures the current window, so use the browser-specific Chrome DevTools Protocol (CDP) when you need content below the viewport. Scroll-and-stitch libraries are a fallback, not a portable shortcut. The right choice depends chiefly on which browser you must support.

Which method should you choose?

Method Browser How it captures a full page Main trade-off
ScreenshotNeo Website screenshot API; no local Selenium browser setup One HTTP request returns an image or PDF Requires an API key and network request; see ScreenshotNeo.
Selenium Firefox full-document API Firefox Uses documented WebDriver methods to save a full-document PNG or return PNG data Direct route when Firefox is acceptable.
Chrome DevTools Protocol (CDP) Chrome and Chromium Uses the Page domain screenshot command with beyond-viewport capture enabled Browser-specific protocol code that must be checked against deployed versions.
Scroll and stitch Potentially useful when direct browser routes do not fit Captures viewport slices while scrolling, then combines them Must handle lazy-loaded content and repeated sticky elements; implementation details vary.

“Full page” means including document content below the visible viewport. Enlarging the browser window does not by itself establish that the entire document was captured. Selenium’s ordinary screenshot APIs describe a current-window or current-browsing-context capture, not a portable full-document capture. See Selenium’s screenshot documentation.

Use Firefox’s built-in full-page screenshot API

The Selenium Python Firefox API documents full-document screenshot methods, including file, PNG-bytes, and base64 output. For a file, use a .png path and check the returned Boolean: False indicates an I/O error and True indicates success. The official API reference is for Selenium 4.50.0; confirm the documentation for the version installed in your environment at Selenium’s Firefox WebDriver API.

Runnable Python example

Install Selenium and make a compatible Firefox browser and driver available in the runtime. This example opens a page, waits for document readiness, writes a full-page PNG, and closes the browser even if capture fails.

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

url = "https://example.com"
out = Path("full-page.png")

options = Options()
options.add_argument("-headless")

driver = webdriver.Firefox(options=options)
try:
    driver.get(url)
    # This checks document readiness, not completion of every app-specific
    # request or lazy-loaded image.
    driver.execute_async_script("""
        const done = arguments[0];
        if (document.readyState === "complete") return done();
        window.addEventListener("load", () => done(), { once: true });
    """)

    ok = driver.get_full_page_screenshot_as_file(str(out))
    if not ok:
        raise OSError(f"Could not write screenshot to {out}")
    print(f"Saved {out}")
finally:
    driver.quit()

The Firefox API also provides save_full_page_screenshot(path), get_full_page_screenshot_as_png(), and get_full_page_screenshot_as_base64(). Use the PNG-returning methods when the next step needs bytes or an encoded payload rather than a file. Do not substitute driver.save_screenshot() for these methods when the requirement is full-document output.

Capture a full page in Chrome or Chromium with CDP

For Chromium, the documented direction is to use CDP’s Page domain: obtain document dimensions with Page.getLayoutMetrics, then call Page.captureScreenshot with beyond-viewport capture enabled. This is not a browser-neutral Selenium feature. CDP is tied to Chromium and its protocol details can change; the official protocol page is tip-of-tree documentation, so check its parameter shapes against the Chrome and Selenium versions actually deployed: Chrome DevTools Protocol Page domain.

Implementation pattern, not a version-independent drop-in

Selenium exposes CDP commands differently across browser and Selenium releases. Treat the following as the sequence to implement, not copy-paste code guaranteed for every version: retrieve layout metrics, select the document content width and height, and invoke Page.captureScreenshot with a clip matching those dimensions and captureBeyondViewport enabled. Decode the returned image data and write it as PNG. Before release, verify the command names, response shape, and parameter support against the protocol served by your installed browser.

  1. Pin or record the Chrome/Chromium and Selenium versions used in production.
  2. Enable or access the Page CDP domain through the mechanism supported by that Selenium release.
  3. Call Page.getLayoutMetrics and use the document-content dimensions appropriate to the installed protocol.
  4. Call Page.captureScreenshot with a clip covering that content and beyond-viewport capture enabled.
  5. Decode the response’s image data, save the PNG, and inspect it on long and dynamic pages in the actual deployment.

A full-page image may be very tall. Large dimensions can increase memory use and output size; choose PDF or split output if the consuming system cannot handle a single tall bitmap. No comparative performance benchmark is established here.

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.

When scroll-and-stitch is a fallback

A stitching approach scrolls through the page, captures viewport-sized images, and combines the slices. It can be useful when the direct Firefox or Chromium-specific routes are unavailable or unsuitable, but it adds work that a browser’s document capture does not: deciding scroll positions, managing overlap, composing slices, and checking for visual discontinuities. A secondary overview of screenshot approaches discusses these caveats at BrowserStack’s Selenium screenshot guide.

  • Lazy-loaded material: scrolling may be needed to trigger images or content that do not load until they approach the viewport. Wait for the required content before taking its slice.
  • Sticky headers and fixed elements: these may appear in every slice. Hide them, account for the overlap, or otherwise handle repetition in the stitching logic.
  • Changing layouts: dynamic content can shift between captures and create gaps or duplicated regions. Use stable page state where possible and inspect the resulting image.

Prepare the page before capture

The capture method only records what the browser has rendered. A load event or document.readyState === "complete" does not prove that a single-page application has finished fetching data, animations have settled, or every lazy image has loaded. Wait for a page-specific selector or condition that represents the content you need. If the target material is lazy-loaded, scroll it into view or otherwise trigger loading before capture, then wait for it to render.

Validate representative pages in the same browser, headless or headed mode, and deployment environment as the production run. The API documentation establishes available methods, but it does not guarantee how every dynamic site will render in your particular setup.

Troubleshooting

  • The screenshot ends at the viewport: check that you did not use save_screenshot() or another ordinary current-window capture. Use Firefox’s full-document method or the Chromium CDP route.
  • Firefox returns False: the file method reports an I/O error. Check that the parent directory exists, the process can write there, and the target path is a PNG filename.
  • Images or content are missing: wait for the site-specific content condition, trigger lazy loading, and capture only after the material has rendered.
  • Repeated bars or seams appear: this is a common stitching issue when fixed or sticky elements recur across slices or the page shifts while scrolling. Adjust the stitch logic or use a direct full-document browser method.
  • CDP command or parameter is rejected: verify the Chrome/Chromium and Selenium versions and consult the protocol exposed by that browser. Do not assume tip-of-tree protocol parameters are supported unchanged in every deployed release.
  • A capture succeeds but looks incomplete: inspect a representative output from the real runtime. A successful file write confirms output was saved, not that the page reached the desired rendered state.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo can return a website screenshot with one GET request. Its cleanup can accept cookie or consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and responses identify the page verdict and billing status in headers. It also provides an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.

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

For example, this Python request saves a WebP screenshot. Replace the URL with the page to capture and provide your API key:

import requests

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

See the ScreenshotNeo API documentation for request options and response details. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Sign up for 1,000 free screenshots a month, with no card required.

Frequently Asked Questions

Can Selenium’s save_screenshot() capture a whole webpage?

No. Selenium documents the ordinary screenshot command as capturing the current window or browsing context; use a full-document Firefox method or a Chromium-specific CDP implementation for below-viewport content.

Does Firefox’s full-page file method save JPEG?

The documented full-document file methods write PNG output. Use a PNG filename; the API also exposes PNG bytes and base64 methods.

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

Is the Chrome CDP approach portable to Firefox?

No. CDP is Chromium-specific. For Firefox, use the Firefox WebDriver full-document screenshot API.

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 *

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

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.