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 desk5 min

How to Capture a Full-Page Screenshot with WebDriver

WebDriver’s standard screenshot is not a portable full-page capture. Use Selenium’s Firefox full-document methods or Chrome’s CDP captureBeyondViewport option.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a full-document screenshot, use Selenium’s documented full-page API with Firefox, or Chrome’s browser-specific DevTools Protocol. WebDriver’s ordinary screenshot command captures the current browsing context; it is not a portable promise to capture the entire document. Choose the route that matches your browser and Selenium binding, then check the image against the page you need to capture.

Choose the capture method for your browser

Browser and route What it captures Output
Selenium with Firefox Selenium documents full-document screenshot methods for Firefox. PNG file or PNG data, depending on the method.
Chrome DevTools Protocol (CDP) Page.captureScreenshot can capture beyond the viewport when captureBeyondViewport is enabled. This is a Chrome-specific protocol capability, not a general WebDriver guarantee. Base64-encoded image data.
Ordinary WebDriver screenshot The current browsing context, as shown in Selenium’s standard screenshot documentation; do not assume it covers the full document. Depends on the binding’s screenshot method.

The Selenium Python Firefox API reference identifies version 4.50.0. The CDP Page reference is the live “tot” protocol documentation, whose fields may evolve. Check the documentation for your installed Selenium and browser versions before relying on a particular integration.

As an Amazon Associate I earn from qualifying purchases.

Capture a full-page screenshot with Selenium and Firefox

Selenium’s Python Firefox API provides save_full_page_screenshot(filename) and get_full_page_screenshot_as_png(). The file method expects a .png filename. These examples use Selenium’s Firefox driver; install Selenium and make Firefox available in your environment before running them.

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

Save directly to a PNG file

from selenium import webdriver

options = webdriver.FirefoxOptions()
# Uncomment to run Firefox without a visible window:
# options.add_argument("-headless")

driver = webdriver.Firefox(options=options)
try:
    driver.get("https://example.com")
    driver.save_full_page_screenshot("page.png")
finally:
    driver.quit()

Get PNG bytes and write them yourself

from selenium import webdriver

options = webdriver.FirefoxOptions()
# options.add_argument("-headless")

driver = webdriver.Firefox(options=options)
try:
    driver.get("https://example.com")
    png_bytes = driver.get_full_page_screenshot_as_png()
    with open("page.png", "wb") as image_file:
        image_file.write(png_bytes)
finally:
    driver.quit()

Use the file method when you want Selenium to save the PNG. Use the bytes method when your program needs to choose how or where to store the image. Selenium’s Java HasFullPageScreenshot interface also documents full-page capture and lists FirefoxDriver as an implementing class; treat this as the documented Firefox path, not a cross-browser WebDriver feature.

Capture beyond the viewport in Chrome with CDP

Chrome’s DevTools Protocol has a separate screenshot route: the Page.captureScreenshot command. Its captureBeyondViewport option defaults to false; set it to true when you need capture beyond the viewport. The command returns base64-encoded image data. The protocol reference defines the capability, but the exact Selenium call for sending CDP commands depends on the Selenium binding and environment you use. Do not substitute an assumed universal WebDriver method.

Page.captureScreenshot({
  "captureBeyondViewport": true
})

Use the CDP integration supported by your installed Chrome and Selenium setup to send that command, then decode the returned base64 image data and save it in the format your workflow requires. Consult the Chrome DevTools Protocol Page reference for the current command parameters and response shape.

Prepare the page and verify the image

A full-page API does not guarantee a perfect rendering of every site. Before capture, wait for the page content you need to appear and use a consistent browser window or device configuration. Inspect the resulting image, especially when the target has dynamic content or very large dimensions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Lazy-loaded images: The API references establish capture capability, not a guarantee that every lazy image has loaded. Check the output and wait for relevant content before taking the screenshot.
  • Animations or changing content: A page that changes while being captured may not produce a consistent image. Verify the captured result for the target site.
  • Fixed-position elements: Headers, banners, or other fixed elements may not appear as expected in a long capture. Inspect for repeated or misplaced elements.
  • Frames and very long pages: The cited documentation does not establish fidelity guarantees for cross-origin frames or extreme document dimensions. Test these cases rather than assuming they are supported perfectly.

When a custom scrolling workaround is necessary

If neither documented native route is available in your browser and binding, scrolling the page in viewport-sized sections and stitching the images is a custom workaround, not an official Selenium full-page screenshot method. It can introduce seams or overlaps, duplicate fixed elements, and capture inconsistent content if the page changes while scrolling. Use it only when those trade-offs are acceptable, and inspect the stitched output carefully.

Troubleshooting

  • The image stops at the viewport: You may be using ordinary WebDriver screenshot behavior, which is not a portable full-document feature. Use Selenium’s Firefox full-page API or Chrome CDP with captureBeyondViewport enabled.
  • The Firefox file method rejects the filename: The documented API expects a .png filename. Use a PNG path, or use the bytes-returning method and handle the output yourself.
  • The Chrome capture does not extend beyond the viewport: Check that the CDP command includes captureBeyondViewport: true; the documented default is false. Also confirm that your Selenium/CDP integration is sending the command to Chrome.
  • The screenshot is missing or inconsistently renders content: Wait for the relevant page content to load and inspect whether it is lazy-loaded, animated, or changing during capture. The APIs do not guarantee fidelity for those behaviors.
  • The screenshot contains odd fixed elements or seams: This can occur with custom scrolling and stitching. A fixed element may be repeated, and changing content may no longer line up across sections.
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 provides a website screenshot API and MCP server. A single GET request can return an image or PDF; the API documentation is at screenshotneo.com/docs.

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

ScreenshotNeo accepts cookie and consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets 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 includes take_screenshot, get_page_info, and capture_pdf for AI agents using Claude, Cursor, or another MCP client. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots.

Sign up for 1,000 free screenshots a month with no card.

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.

Official references

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. 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
Crashes, No Sound, or Screen Glitches?Free driver scan
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.