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

Resize the browser to the responsive width you need, load the page, then use the screenshot command supported by your driver. In Python, driver.set_window_size(1366, 900) sets the viewport condition; driver.save_screenshot() captures only the current window, while Firefox WebDriver also provides save_full_page_screenshot() for the entire document.

Window size and document height solve different problems. Width determines whether the page renders its desktop, tablet or mobile layout. A full-page method determines whether content below the visible viewport is included. Treat both as explicit test settings.

Choose the capture method before writing the test

Selenium’s common screenshot commands capture the current browser window. That is a viewport screenshot, even if the page has much more content below the fold. Firefox exposes a first-class full-document API; Chrome and other drivers generally require a browser-native capability or a page-specific capture-and-stitch workflow.

Goal Recommended approach What the output represents
Test a responsive layout at a known width set_window_size(width, height) followed by save_screenshot() The visible browser window at the selected width and height
Capture the whole document in Firefox save_full_page_screenshot() or get_full_page_screenshot_as_file() A document-length PNG, including content outside the current window bounds
Capture a whole document in a driver without an explicit full-page API Use a browser-native full-page capability where available, or scroll and stitch screenshots A full image assembled according to the page’s scrolling behavior

The width is not merely an image-scaling setting. Responsive breakpoints can replace navigation, change typography, alter column counts and reveal or hide content. Select a width that matches the device or layout you are documenting.

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

Firefox: resize the window and save a true full-page image

Firefox’s Python WebDriver API includes save_full_page_screenshot(filename), which saves a full document screenshot of the current window. It also offers PNG and base64-returning variants.

Complete Python example

from selenium import webdriver

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

driver = webdriver.Firefox(options=options)
try:
    # Width selects the responsive layout; height selects the visible viewport.
    driver.set_window_size(1366, 900)
    driver.get("https://example.com")

    # Firefox captures the document, not just the visible viewport.
    driver.save_full_page_screenshot("page.png")
finally:
    driver.quit()

Use set_window_rect(width=1366, height=900) instead when your driver supports it. Keep the navigation and capture inside a try/finally block so a failed page or assertion still closes the browser.

Viewport-only Firefox capture

from selenium import webdriver

driver = webdriver.Firefox()
try:
    driver.set_window_size(1366, 900)
    driver.get("https://example.com")
    driver.save_screenshot("viewport.png")
finally:
    driver.quit()

This second example intentionally records only the current window. It is useful when the requirement is a visual check of the above-the-fold layout rather than a document archive.

Other Firefox return formats

When you need the bytes instead of a file, Firefox provides get_full_page_screenshot_as_png() and get_full_page_screenshot_as_base64(). The file method is usually simplest for CI artifacts; the byte methods are convenient when an application uploads the image directly.

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

Chrome and other drivers: understand the limitation

The common Selenium commands save_screenshot(), get_screenshot_as_file() and get_screenshot_as_png() describe the current window. Resizing the window does not turn one of those commands into a full-document capture.

First preference: a browser-native full-page capability

Check the driver and browser version you have selected for a native full-page command. Keep the viewport width explicit, because the same page can produce materially different images at 1280 pixels and 375 pixels. If the native capability is unavailable or behaves differently on your target pages, use a controlled stitching routine and validate its output.

Fallback: scroll, capture, and stitch

A stitching fallback takes overlapping viewport screenshots while scrolling through the document, then composes them into one image. It is not a universal Selenium guarantee. Fixed headers, sticky toolbars, lazy loading and nested scroll regions can create duplicate or missing pixels.

  1. Set the final window width and a practical viewport height.
  2. Wait for the initial page load and any application-specific readiness condition.
  3. Measure the document and identify the scrollable element. Do not assume the top-level document owns the scroll bar.
  4. Scroll in viewport-sized increments with a deliberate overlap.
  5. Capture after each scroll settles. Keep the scroll position and image dimensions in your log.
  6. Remove overlap when composing the images, and account for fixed or sticky elements that appear in every frame.
  7. Compare the assembled image with the live page at several scroll positions.

For an internal scrolling panel, scroll that panel rather than the window. A full-page operation aimed at the document cannot automatically include content hidden inside an independently scrolling element.

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

Make dynamic pages deterministic

Full-page capture is only as reliable as the page state at capture time. A page can still be loading images, running an animation or changing its layout after the browser reports navigation complete.

Wait for content that affects the image

  • Wait for a page-specific selector that indicates the main content is present.
  • Wait for images or data-driven sections that are known to load after navigation.
  • For lazy-loaded content, scroll through the page before the final capture when your chosen method does not trigger loading automatically.
  • Disable or settle animations when your test permits it; otherwise capture the same animation phase consistently.

Check the result, not just the exit code

Open the generated PNG and inspect the top, middle and bottom. Confirm that navigation did not switch to a mobile breakpoint unexpectedly, that images are not blank placeholders, and that a fixed header has not been repeated through a stitched document.

Window dimensions, viewport dimensions and responsive breakpoints

set_window_size(width, height) specifies browser window dimensions. Browser chrome and operating-system behavior can affect the resulting content viewport, especially in headed mode. If an exact CSS viewport is critical, record the browser, driver, headless mode and operating system along with the requested size.

Setting Controls Typical use
Width Responsive layout and breakpoint selection Desktop, tablet or mobile visual regression
Height Visible area for viewport captures and each stitching segment Consistent above-the-fold snapshots or manageable stitch steps
Full-page mode Whether content beyond the current viewport is included Document archives, reports and long-page review

Do not make the window extremely tall as a substitute for full-page capture. Some pages calculate layout from the viewport height, and very large surfaces can expose browser or image-memory limits without solving nested scrolling.

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

Common failures and precise fixes

The image stops at the fold

Cause: save_screenshot() and related common methods capture the current window.

Fix: Use Firefox’s save_full_page_screenshot(), a supported browser-native full-page capability, or a validated stitching workflow.

The page uses the wrong layout

Cause: The requested width selected a different responsive breakpoint, or the effective content viewport differs from the window size.

Fix: Set the width before navigation, record the actual browser configuration, and choose a width that represents the device layout you need to document.

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

Lower sections are blank

Cause: Lazy images, deferred data requests or animations had not settled.

Fix: Wait for a meaningful selector or application-ready state, trigger lazy loading deliberately, and capture only after content is stable.

Only part of a panel appears

Cause: The content is inside an internal scrolling container.

Fix: Locate the element that owns scrolling and capture or stitch that element separately. Increasing the outer window height does not expose the panel’s hidden content.

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.

Stitched output has repeated headers or seams

Cause: A fixed or sticky element was present in every frame, or overlap removal was inaccurate.

Fix: Use overlap, detect the repeated region, compensate for sticky elements, and compare seams at several scroll positions. For pages where this is unacceptable, prefer a native full-document API.

The browser fails in CI but works locally

Cause: Headless and headed modes, screen resolution, fonts, timing and available memory differ.

Fix: Pin the browser and driver versions used by the job, set the window dimensions explicitly, wait on page state rather than a fixed short delay, and retain the failed image and browser logs as artifacts.

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

Performance, reliability and storage considerations

A full-document image consumes more memory than a viewport image, and a very long page can produce a large PNG. Prefer JPEG or WebP when your downstream process accepts lossy or modern formats; keep PNG for pixel-accurate comparisons and transparent graphics. In CI, write files to a known artifact directory and clean them after upload.

Use a consistent capture policy: the same browser family, viewport width, device scale behavior, fonts, color scheme and wait conditions. A screenshot that is technically complete but captured before web fonts load is not a dependable regression artifact.

For stitching, limit the number of frames by using the tallest practical viewport, but do not choose a height that causes browser instability. Overlap improves seam detection but increases processing and storage. Log the document height, number of frames and final image dimensions so a sudden change is diagnosable.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When an API is easier than managing a browser

Running Selenium yourself gives you direct control over browser state, custom test code and page-specific scrolling. It also means maintaining browser binaries, drivers, waits, fonts, memory limits and stitching logic. For repeatable URL-to-image jobs, an API can move those concerns out of your test runner.

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

Or skip the browser setup

ScreenshotNeo is the first option to try when you want a hosted screenshot API: it removes cookie banners, newsletter popups and chat widgets before capture, bills only clean shots, and offers an MCP server for AI agents. 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.

One GET request returns PNG, JPEG, WebP or PDF. The API supports full-page capture with lazy images loaded, CSS-selector element capture, dark mode, 12 device presets or a custom viewport, retina scale, PDF paper settings and page ranges, custom CSS and JavaScript, clicks, selector or network-idle waits, request and resource blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, configurable-TTL caching, signed links, asynchronous jobs with signed webhooks, bulk capture for up to 100 URLs per call, usage reporting and an OpenAPI specification. Parameter names used by other screenshot APIs also work, which can simplify migration.

Use the ScreenshotNeo documentation for authentication and the complete option reference. The following cURL request saves a WebP screenshot:

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

Python request

import requests

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

Node.js request

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
const buffer = Buffer.from(await res.arrayBuffer());
require('fs').writeFileSync('shot.webp', buffer);

The free plan includes 1,000 screenshots each month with no card. Paid plans start at $5 for 3,000 shots; every feature is available on every plan, and yearly billing gives two months free. Create a free ScreenshotNeo account to get the 1,000 monthly shots without adding a card.

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

Which approach should you use?

  • Use Firefox full-page capture when you need a true document image inside a Selenium test and Firefox is an acceptable test browser.
  • Use a native capability in another browser when your selected driver explicitly supports full-page capture and its behavior matches your pages.
  • Stitch manually when you need cross-driver control or special handling for internal scroll regions, accepting the need for visual validation.
  • Use ScreenshotNeo when the job is primarily URL-to-image or PDF capture and you would rather not operate a browser, tune waits or maintain stitching code.

FAQ

Does increasing Selenium’s window height capture the entire page?

No. It changes the visible viewport. A full-document API or a capture-and-stitch process is still required for content below the viewport.

Can I use a mobile width with a full-page screenshot?

Yes. Set the desired width before navigation. The resulting document follows the responsive layout selected by that width, subject to the browser and page’s own breakpoint logic.

Why is Firefox’s full-page method different from the common Selenium command?

Firefox WebDriver exposes explicit full-document methods, whereas the common screenshot commands represent the current window.

Is stitching guaranteed to match a native full-page screenshot?

No. Sticky elements, animations, lazy loading and nested scroll containers make stitching page-specific. Validate the composed image against the live page.

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

Frequently Asked Questions

What does Selenium capture by default?

The common screenshot commands capture the current browser window, not the complete document.

Which Firefox method saves a full document?

Use save_full_page_screenshot(filename); Firefox also provides file, PNG and base64 full-page variants.

What should I do for an internal scrolling element?

Capture or stitch the element that owns the scroll region; resizing the outer window does not reveal its hidden content.

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.

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.