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

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

Use Firefox’s dedicated full-document screenshot method, not Selenium’s ordinary viewport capture. Load the page with webdriver.Firefox(), call get_full_page_screenshot_as_file() (or save_full_page_screenshot()) with an absolute .png path, and check the Boolean result. For an in-memory workflow, use the PNG-byte or Base64 variants.

Working Python example: save the entire document

This is the shortest complete Selenium example for Firefox. The full-page methods are Firefox WebDriver APIs exposed through Marionette.

from pathlib import Path
from selenium import webdriver

url = "https://example.com/long-page"
output = Path("/absolute/path/page.png")

with webdriver.Firefox() as driver:
    driver.get(url)
    written = driver.get_full_page_screenshot_as_file(str(output))
    if not written:
        raise OSError(f"Could not write screenshot to {output}")

print(f"Saved full-page screenshot to {output}")

Replace the URL and path with your values. The filename must be a full path ending in .png. The method returns True when Selenium writes the file and False when an I/O error prevents the write, so treating a false result as an exception avoids silently publishing a missing image.

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.

Use the equivalent method name when preferred

Firefox’s Selenium API also exposes save_full_page_screenshot(filename). It has the same purpose: save the complete document as a PNG to the supplied path.

from selenium import webdriver

with webdriver.Firefox() as driver:
    driver.get("https://example.com/long-page")
    if not driver.save_full_page_screenshot("/absolute/path/page.png"):
        raise OSError("Screenshot could not be written")

Use one method or the other; there is no need to call both.

Prerequisites and a reliable setup

  • Python with Selenium installed.
  • Firefox installed on the machine that runs the script.
  • A compatible Firefox WebDriver/geckodriver setup that Selenium can start.
  • Write permission for the destination directory.

Keep Selenium, Firefox and geckodriver compatible. Full-document support is a Firefox/Marionette behavior, and details can change between installed versions. If a method is missing or the session fails during startup, check the API version and the compatibility of all three components before changing your screenshot code.

Use an absolute destination path rather than relying on the process’s current directory. In CI, containers and scheduled jobs, the current directory may differ from your local shell, and a relative path can make a successful capture appear to have disappeared.

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

File output versus bytes or Base64

The file methods are convenient for tests and batch jobs. When an API response, database record or image pipeline needs the result in memory, Firefox’s Selenium API provides PNG bytes and a Base64 string.

PNG bytes

from selenium import webdriver

with webdriver.Firefox() as driver:
    driver.get("https://example.com/long-page")
    png_bytes = driver.get_full_page_screenshot_as_png()

with open("/absolute/path/page.png", "wb") as image_file:
    image_file.write(png_bytes)

get_full_page_screenshot_as_png() returns the complete capture as binary PNG data. You can pass those bytes directly to an HTTP client, object-storage SDK or test assertion without creating an intermediate file.

Base64

import base64
from selenium import webdriver

with webdriver.Firefox() as driver:
    driver.get("https://example.com/long-page")
    encoded = driver.get_full_page_screenshot_as_base64()

png_bytes = base64.b64decode(encoded)
with open("/absolute/path/page.png", "wb") as image_file:
    image_file.write(png_bytes)

The Base64 method is useful when the receiving protocol expects text, such as a JSON payload. Decode it before writing a PNG file or handing it to an image library.

What “full page” means in Firefox WebDriver

A normal Selenium screenshot call captures the current viewport. Firefox’s full-document methods request the complete document, including content below the fold, in one PNG. They are separate operations from get_screenshot_as_file(); changing the window size or scrolling does not turn the ordinary method into a guaranteed full-page capture.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Operation Result Best use
get_screenshot_as_file() Current viewport A visible-state check or a screenshot of what a user currently sees
get_full_page_screenshot_as_file() Complete document as PNG Long pages, archives and visual-regression baselines
get_full_page_screenshot_as_png() Complete document as PNG bytes In-memory processing or upload
get_full_page_screenshot_as_base64() Complete document as Base64 text JSON or text-only transports

The APIs do not promise that every page’s lazy images, animations, sticky elements or cross-origin embeds will render identically in every environment. If those details matter, validate the target page and make the page’s own loading state deterministic before capturing.

Lower-level Marionette semantics

Marionette’s Python client exposes the underlying screenshot operation directly:

png_bytes = marionette.screenshot(format="binary", full=True)

With no element supplied, full=True captures the complete frame; full=False requests only the viewport. The format value controls the return type: "binary" returns PNG bytes, while the client also supports Base64 and a SHA-256 hash format. The command carries full, scroll and an optional element ID to Marionette’s WebDriver:TakeScreenshot operation.

This lower-level call belongs to a Marionette client session. In ordinary Selenium code, prefer the Firefox WebDriver methods shown above unless you specifically need Marionette’s extra controls.

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

Capturing one element instead of the document

When an element is supplied, Marionette limits the image to that element’s bounding box rather than the whole page. The scroll argument controls whether Marionette scrolls the element into view before taking the image.

# Conceptual Marionette-client call
png_bytes = marionette.screenshot(
    format="binary",
    full=False,
    element=element_id,
    scroll=True,
)

Use an element capture for a chart, card or component. Do not expect it to include content outside the element rectangle, even when the element itself is on a very long page.

Preparing a page for a trustworthy capture

Full-document capture takes a snapshot of the browser state at the time of the call. For repeatable output:

  1. Navigate to the final URL and wait for the page’s own readiness condition (for example, a known element your test controls).
  2. Dismiss application dialogs or consent UI that would otherwise cover content.
  3. Ensure fonts, images and client-rendered sections have finished loading before calling the screenshot method.
  4. Disable or wait for animations when pixel-level comparisons matter.
  5. Write to a unique, absolute path in parallel jobs so two sessions cannot overwrite one another.

These are page-level precautions, not guarantees supplied by the screenshot API. A page can still change while it is being painted, and a site can respond differently to a test browser than to a normal visitor.

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

Troubleshooting common failures

The image contains only the visible viewport

Cause: the script called get_screenshot_as_file() or another ordinary screenshot method.

Fix: use Firefox’s get_full_page_screenshot_as_file(), save_full_page_screenshot(), PNG-byte or Base64 method. Full-page behavior is not identical across WebDriver implementations.

The method is missing

Cause: an older Selenium package, a non-Firefox driver, or a session that is not using Firefox WebDriver.

Fix: confirm that the driver was created with webdriver.Firefox(), update Selenium in the environment where the script runs, and verify the installed Selenium, Firefox and geckodriver versions are compatible. Check the API documentation for that installed version.

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

The method returns False

Cause: Selenium could not write the file, commonly because the directory does not exist or the process lacks permission.

Fix: create the destination directory, use an absolute path ending in .png, and check filesystem permissions. Keep the explicit Boolean check in production code.

Firefox will not start

Cause: Firefox or geckodriver is unavailable, incompatible, or blocked by the execution environment.

Fix: run a minimal webdriver.Firefox() session first, inspect the driver startup error, and align the browser, driver and Selenium versions. In containers, also verify that the image includes Firefox and the libraries it needs.

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

Content below the fold is blank or incomplete

Cause: the page has not finished its own loading process, uses lazy rendering, or changes during capture.

Fix: wait for a page-specific readiness element or network-idle condition implemented by your test, then capture. If the site requires scrolling to trigger lazy content, perform that interaction and wait for the resulting elements before taking the screenshot. Verify the result on the actual page; the API does not promise identical handling for every lazy-loading implementation.

The screenshot is unexpectedly huge

Cause: a long document produces a correspondingly tall PNG, which consumes memory and storage.

Fix: capture a specific element when a whole document is unnecessary, use the in-memory method only when your consumer can handle the byte size, and archive or resize images after capture rather than assuming a viewport-sized file.

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

Operational and cost considerations

Firefox must render the page and encode one potentially tall PNG, so full-page captures generally require more time and memory than viewport images. Set a sensible WebDriver command timeout in the surrounding test harness, clean up sessions with a context manager, and avoid launching a new browser for every URL when a controlled batch can reuse one session.

For visual regression, store the browser, operating-system, viewport and device-pixel settings alongside each baseline. Differences in fonts, rendering engines, timing and responsive breakpoints can create image diffs even when the page’s HTML is unchanged.

The browser method itself has no ScreenshotNeo usage charge: it runs in your own Firefox environment. Your operational costs are the machine, browser sessions, storage and maintenance of compatible Selenium/Firefox/geckodriver versions.

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 when you do not want to maintain Firefox and Marionette. A GET request returns a PNG, JPEG, WebP or PDF. Before capture it accepts the cookie or consent banner like a visitor and removes more than 60 known consent platforms, newsletter popups and chat widgets; each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers.

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

See the parameter reference in the ScreenshotNeo documentation. This one-call example targets the same kind of long page:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com/long-page -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/long-page"},
    timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)

Node.js

const q = new URLSearchParams({
  access_key: 'YOUR_API_KEY',
  url: 'https://example.com/long-page'
});
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));

ScreenshotNeo also offers full-page capture with lazy images loaded, CSS-selector element capture, dark mode, device presets or custom viewports, retina scale, PDF page controls, custom CSS and JavaScript, click-before-capture actions, selector hiding, waits, request blocking, custom headers/cookies/user agents and Authorization, timezone and geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed image links, asynchronous jobs with signed webhooks, bulk capture for up to 100 URLs per call, a usage API and an OpenAPI specification. Its MCP server exposes take_screenshot, get_page_info and capture_pdf for Claude, Cursor and other MCP clients.

Plan Allowance Price
Free 1,000 shots/month $0, no card
Starter 3,000 shots $5
Growth 15,000 shots $15
Pro 60,000 shots $39
Scale 250,000 shots $99
Business 1,000,000 shots $249

Yearly billing gives two months free, and every feature is included on every plan. Start with 1,000 free screenshots a month on ScreenshotNeo, with no card required.

FAQ

Does Selenium’s full-page method save JPEG or WebP?

The Firefox Selenium methods documented here save a PNG or return PNG data. Choose another format after capture with an image-processing tool, or use an API that natively returns JPEG or WebP.

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.

Can I use the same full-page call with ChromeDriver?

Do not assume it. The methods in this article are documented for Selenium’s Firefox API and Marionette. Other WebDriver implementations can expose different full-page behavior.

What does full=False do in Marionette?

When no element is supplied, full=False requests the viewport rather than the complete document. With an element, the screenshot is constrained to that element’s bounding box.

Why should the output path end in .png?

The Firefox API documents full-page file output as PNG and specifies a full filename ending in .png; using that form also makes the intended file type unambiguous.

Frequently Asked Questions

Can Selenium’s full-page method save JPEG or WebP?

The Firefox Selenium methods save or return PNG data. Convert it afterward, or use a service that natively returns JPEG or WebP.

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

Can I use the same call with ChromeDriver?

Do not assume so. These methods are documented for Firefox WebDriver and Marionette; other drivers can expose different behavior.

What does Marionette full=False do?

With no element, it requests the viewport instead of the complete document. With an element, the image is limited to that element’s bounding box.

Why must the path end in .png?

Firefox’s full-page file API documents PNG output and asks for a full filename ending in .png.

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.

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