ScreenshotNeo

BlogHow-to

Selenium Screenshot Is Cut Off at the Bottom: How to Fix It

Find out whether Selenium captured only the viewport or missed content that had not loaded, then choose the right fix for your browser and page.

By the ScreenshotNeo team4 October 20267 min read

If a Selenium screenshot ends at the bottom of the visible browser window while the page continues below, Selenium captured the viewport, not the full document. With Python and Firefox, use Selenium’s documented full-page screenshot method. If the image is already full height but lower content is blank or missing, wait for that content to render and load before capturing.

First identify which problem you have: a screenshot that stops at the viewport edge needs a different capture scope; a full-height screenshot with incomplete content needs a page-readiness fix. Maximizing the browser can show more content, but it does not turn a viewport screenshot into a full-document capture.

1. Diagnose what “cut off” means

What you see Likely cause What to try
The image ends exactly at the visible window’s bottom, but the page continues Normal viewport screenshot behavior Use a documented full-document method for your browser and binding, or capture a larger viewport if that is all you need.
The image is page-height, but its lower sections are blank, stale, or missing images Content was not ready when capture ran; assets may be lazy-loaded Wait for an application-specific readiness condition and, when appropriate, scroll to trigger deferred loading.
Even the visible viewport is cropped unexpectedly Window geometry, browser or driver configuration, or the wrong output file may be involved Inspect the configured window size, confirm which file the current run wrote, and check the output dimensions.

The standard WebDriver screenshot command captures the current browsing context’s viewport. Selenium documents Firefox Python methods for full-document capture separately. These APIs are browser- and binding-specific; do not assume a full-page method is portable across every Selenium language, browser, driver, and version. See the W3C WebDriver specification and Selenium’s Firefox Python API.

2. Capture the full page with Python and Firefox

For a full-document PNG in Selenium’s Python Firefox binding, call get_full_page_screenshot_as_file(). The API also documents save_full_page_screenshot(). The output path should end in .png; the save method returns a Boolean, so check it.

from pathlib import Path
from selenium import webdriver

out = Path("full_page.png").resolve()
driver = webdriver.Firefox()
try:
    driver.get("https://example.com")
    saved = driver.get_full_page_screenshot_as_file(str(out))
    if not saved:
        raise OSError(f"Could not save screenshot to {out}")
finally:
    driver.quit()

Install Selenium in the Python environment used to run the script with python -m pip install selenium. This recipe is specifically for Python with Firefox. Check the API documentation for your installed Selenium version before using it elsewhere.

The ordinary WebDriver screenshot method is a viewport capture. Do not substitute it and expect a full-page result:

# Saves the current viewport, not the entire document
saved = driver.save_screenshot("viewport.png")

3. If the full-height image has missing content

Navigation returning does not prove every part of a modern page is ready. Selenium’s navigation behavior waits for a page-load event, while JavaScript applications may continue rendering or fetching data afterward. Lazy loading can defer images and other resources until they are near the viewport. Use the condition that represents readiness for the specific page, rather than relying on an arbitrary sleep.

For viewport-triggered lazy loading, a scrolling pass can help request content farther down the page. Then wait for the relevant assets or application state and return to the intended position before capturing:

from selenium.webdriver.support.ui import WebDriverWait

# Run after navigation when the page uses viewport-triggered loading.
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")

# Replace this example with a condition that proves your page is ready.
# For example, wait for a page-specific final section or loading marker to disappear.
WebDriverWait(driver, 15).until(
    lambda d: d.execute_script("return document.readyState") == "complete"
)

driver.execute_script("window.scrollTo(0, 0);")
saved = driver.get_full_page_screenshot_as_file("full_page.png")
if not saved:
    raise OSError("Could not save full_page.png")

document.readyState alone may not be enough for a JavaScript application: it does not establish that application data, animations, or every lazy image has finished. Prefer a page-specific condition, such as the expected content appearing or a loading indicator disappearing. The scroll example is not universal. Infinite-scroll pages may keep appending items, content may use a nested scroll container, and scrolling can alter sticky headers or page state. Adapt the trigger and readiness check to the page. See MDN’s overview of lazy loading.

4. If you only need a larger viewport

When the test needs a bigger visible area rather than the entire document, resize or maximize the window before taking the normal screenshot. Selenium documents these as window geometry operations, separate from full-document capture.

from selenium import webdriver

driver = webdriver.Firefox()
try:
    driver.set_window_size(1440, 1200)
    driver.get("https://example.com")
    driver.save_screenshot("larger_viewport.png")
finally:
    driver.quit()

You can use driver.maximize_window() instead of set_window_size() when the environment supports maximizing. In headless or remote environments, inspect the actual viewport dimensions rather than assuming the requested window size produced the dimensions you want. A larger viewport still captures only the visible region.

5. Choose an approach for your browser and binding

Need Approach Important limit
Capture only what is visible Use the standard WebDriver screenshot command. Content below the viewport is excluded.
Show more content in one bounded image Set or maximize the browser window, then capture. This changes viewport geometry; it does not request the full document.
Capture the full document in Python Firefox Use get_full_page_screenshot_as_file() or save_full_page_screenshot(). These are the documented Firefox Python APIs covered here; verify support for your exact stack.
Capture the full document with another browser or language Consult the documentation for that exact Selenium binding, browser, driver, and version. The research here does not establish a portable, version-safe full-page recipe for other stacks.

Selenium’s Chrome documentation includes Chrome DevTools Protocol command execution, but the sources for this guide do not establish a complete, version-safe full-page Chrome recipe. Avoid copying a browser-specific workaround without checking its version requirements and validating the resulting artifact.

6. Validate the saved screenshot

  1. Check that the screenshot method returned success and that the destination path is writable.
  2. Open the exact output file written by the current run; avoid inspecting a stale screenshot from an earlier run.
  3. Check the image dimensions and whether the intended page bottom appears in the image.
  4. If the screenshot has full-document dimensions but missing lower content, revisit the page-specific readiness condition and lazy-loading behavior.
  5. If only the viewport is present, confirm you called a full-document API supported by your exact browser and binding.

7. Troubleshooting common failures

Symptom Likely cause Fix
Screenshot stops at the fold The script used the ordinary viewport screenshot command. Use the documented full-document method for the browser and binding, or resize the viewport if a larger visible region is sufficient.
Maximizing did not include the whole page Maximize changes window geometry; it does not change screenshot scope. Use a full-document API supported by your stack.
Bottom sections are blank or images are absent Capture ran before client-side content or lazy-loaded resources were ready. Wait for the relevant page state; trigger viewport-based loading if appropriate, then verify the content before capture.
Firefox method is missing The code may be running with a different browser, binding, or Selenium version than the documented Firefox Python API. Confirm the active driver and installed binding version. Use only an API documented for that combination.
The save call reports failure or no file appears The output directory may not exist or be writable, or the path may be invalid. Resolve the path, ensure its parent directory exists and is writable, and check the method’s Boolean result.
The image looks unchanged after a code fix You may be opening an old output file or writing to a different working directory. Use an absolute output path and inspect the file timestamp or dimensions after the run.
Some content remains absent after scrolling The page may use infinite scrolling, a nested scroll container, or application-specific loading logic. Scroll the relevant container, stop when the required content is present, and wait on the site’s own readiness signal.

Or skip the browser setup

ScreenshotNeo is a website screenshot API: one GET request returns an image or PDF. Its [API documentation](/docs/) explains the options. For example, save a WebP screenshot of a page with cURL:

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

Cookie banners, newsletter popups, and chat widgets are removed before the shot. Bot checks, blank pages, and failed loads are never billed. An MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.

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

Performance, reliability, and cost notes

  • Performance: Full-document captures can produce larger images than viewport captures, especially for long pages. Capture only the scope your test needs and avoid unnecessary scrolling or repeated captures.
  • Reliability: A full-page API addresses capture scope, not whether the page’s application content is ready. Wait for meaningful page state and inspect the output.
  • Cost: Selenium is browser automation that you run in your own environment; account for the compute and execution time of that environment. If you use a screenshot service instead, check its billing rules and the cost of the volume you need. ScreenshotNeo’s stated plans include 1,000 free shots per month and paid tiers from $5 for 3,000.

FAQ

Does Selenium always capture the whole page?

No. The standard WebDriver screenshot captures the current viewport. Full-document capture depends on the browser and binding API.

Will a fixed sleep solve missing content?

Not reliably. Wait for the specific content or application state your capture depends on; timing varies across pages and runs.

Is the Firefox full-page method available in every Selenium language?

This guide verifies it in Selenium’s Python Firefox API. Check the exact documentation for other bindings and browsers.

Can I capture just one element instead of the full page?

Selenium supports element screenshots in some bindings, but the exact behavior is binding-specific. Consult your binding’s API and verify the resulting image dimensions.