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

First decide what “save an image” means: to capture what Firefox renders, use Selenium’s screenshot methods; to keep the original image file, trigger a download and configure Firefox to save it without prompting. A screenshot is not the original image bytes. The right method depends on which output you need.

Choose between a rendered screenshot and the original image

A screenshot rasterizes the page or element as Firefox displays it. That is useful for visual checks, documentation, and capturing a page state. Downloading an image instead saves the file returned by the site, such as a JPEG or WebP; it preserves the response bytes rather than the browser’s rendered appearance.

Goal Use What you get
Capture the visible browser viewport driver.save_screenshot(path) A PNG of the current viewport. Selenium Firefox WebDriver API
Capture the full document driver.save_full_page_screenshot(path) A full-document PNG; Selenium documents a PNG extension and a path for the output. Selenium Firefox WebDriver API
Capture one image or other DOM element element.screenshot(path) A PNG of that rendered element; the method returns a boolean indicating success. Selenium WebElement API
Save the image file itself Click its download link with Firefox download preferences configured, or use an authorized HTTP-client approach The server’s response file, not a screenshot of the page

If you need the exact original image, do not use a screenshot method. A rendered image can differ from the source file because it may be resized, cropped, styled, or displayed from a responsive variant.

Capture a viewport, full page, or element with Selenium

Set up the Python environment

Install Selenium in the environment that runs the script:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
python -m pip install selenium

The code below uses Selenium’s Firefox WebDriver. Firefox must be available in the execution environment; Selenium’s driver setup depends on the Selenium and Firefox versions in use. The examples create output directories so that a missing folder does not prevent a screenshot from being written.

Save the visible viewport

from pathlib import Path
from selenium import webdriver

out = Path("artifacts")
out.mkdir(parents=True, exist_ok=True)

driver = webdriver.Firefox()
try:
    driver.get("https://example.com")
    ok = driver.save_screenshot(str(out / "page.png"))
    if not ok:
        raise OSError("Firefox could not write the screenshot")
finally:
    driver.quit()

save_screenshot captures the current viewport, not necessarily every part of a long page. Navigate to the page and wait for the state you want before capturing it. The returned boolean lets the script treat a failed write as an error instead of silently proceeding with a missing or unusable file. See the Firefox WebDriver screenshot methods.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors

Save a full-document screenshot

from pathlib import Path
from selenium import webdriver

out = Path("artifacts")
out.mkdir(parents=True, exist_ok=True)

with webdriver.Firefox() as driver:
    driver.get("https://example.com")
    ok = driver.save_full_page_screenshot(str(out / "page-full.png"))
    if not ok:
        raise OSError("Firefox could not write the full-page screenshot")

This method captures the full document rather than only the visible viewport. Use a .png filename, as documented for the full-page API. Check the final file in the environment where the script runs, particularly in CI, where the working directory may not be the directory you expect. Selenium Firefox WebDriver API.

Save one rendered image element

from pathlib import Path
from selenium.webdriver.common.by import By

out = Path("artifacts")
out.mkdir(parents=True, exist_ok=True)

image = driver.find_element(By.CSS_SELECTOR, "img.hero")
ok = image.screenshot(str(out / "hero.png"))
if not ok:
    raise OSError("Firefox could not write the element screenshot")

Run this after navigating with a live driver. Replace img.hero with a selector that identifies the desired element on your page. Element screenshots are useful when you want the displayed region without surrounding page content; they capture the rendered element, not necessarily its original source file. Selenium documents a PNG output and boolean success result for this method. WebElement screenshot API.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

Download the original image with Firefox

To save the server’s image response, configure Firefox’s download directory and file-type behavior before starting the WebDriver, then navigate to the page and click its download link. Firefox settings distinguish the destination folder from actions for individual file types. The Selenium Python FAQ documents this preference pattern; Mozilla’s support material explains Firefox’s download-folder and file-type controls. Selenium Python FAQ · Mozilla Support: change what Firefox does when opening a file.

from pathlib import Path
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.by import By

out = Path("downloads").resolve()
out.mkdir(parents=True, exist_ok=True)

options = Options()
options.set_preference("browser.download.folderList", 2)
options.set_preference("browser.download.dir", str(out))
options.set_preference("browser.download.useDownloadDir", True)
options.set_preference(
    "browser.helperApps.neverAsk.saveToDisk",
    "image/jpeg,image/png,image/webp,application/octet-stream",
)
options.set_preference("pdfjs.disabled", True)

driver = webdriver.Firefox(options=options)
try:
    driver.get("https://example.com/gallery")
    driver.find_element(By.CSS_SELECTOR, "a.download-image").click()
    # Wait for the completed file before opening or consuming it.
finally:
    driver.quit()

Replace the example page and selector with the actual page and download control. The MIME list is illustrative: the correct type depends on the response. Prefer checking the server’s Content-Type and adding the actual image type rather than assuming an extension tells you the MIME type. A server may return WebP even when the page or link makes the file look like JPEG.

Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

These preference names and Firefox’s handling can vary with browser versions. Confirm the settings against the Firefox version used in your automation environment, and verify that a completed file appears in the absolute directory before using it. A temporary download extension or a still-changing file can indicate that the download has not finished.

Authenticated image URLs

If the image is behind a login, a direct HTTP request may need the same authentication cookies or headers as the browser. An alternative is to obtain the image URL and make an HTTP request with the required session credentials, but that is an application-level download strategy, not a Firefox screenshot operation. Follow the site’s access rules and avoid copying session credentials into logs or source control.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why Firefox may show a save dialog, including in headless runs

  • Preferences were set too late: configure them on Options before calling webdriver.Firefox(). Changing settings after the browser starts does not configure that startup session.
  • The response MIME type is missing from the preference: add the type Firefox actually receives to browser.helperApps.neverAsk.saveToDisk. Do not assume the type from the link text or filename.
  • The site opens the image instead of downloading it: browser behavior depends on the page’s link and response. Use the site’s download control when available, or an authorized HTTP request if you need the response bytes.
  • Headless mode behaves differently: retain the same download preferences and check the Firefox and Selenium versions used in both modes. Headless operation does not change the need to configure downloads before driver startup.

Firefox’s download destination and per-file-type actions are separate settings, so setting a folder alone may not prevent a prompt for a type Firefox does not know how to save automatically. Mozilla Support documents those distinct controls.

Firefox download API portability

Do not assume Selenium’s generic downloadable-file methods work with Firefox. The current Firefox WebDriver reference says get_downloadable_files is implemented only in RemoteWebDriver; Firefox’s documented route for screenshots remains its screenshot methods, while downloads can be handled through browser preferences. Check the API documentation for the specific driver mode you use rather than building a Firefox workflow around a method not implemented there. Firefox WebDriver reference.

Troubleshoot missing, wrong, or incomplete files

  • You saved a screenshot instead of the original: use a download link or an authorized HTTP request for original response bytes. Use save_screenshot, save_full_page_screenshot, or element.screenshot only for rendered output.
  • The output file is missing: create the destination directory, use an absolute path, check the working directory, and wait until the download has completed before reading the file.
  • The downloaded file has a temporary extension: treat the download as incomplete. Wait for the final filename and confirm its size stops changing before consuming it.
  • The screenshot is blank or incomplete: wait until the page and image are ready before capturing. For a specific image, locate and capture its element; for content beyond the viewport, use the full-document method.
  • The save prompt still appears: verify preferences were passed at driver creation and that the actual response MIME type is listed in browser.helperApps.neverAsk.saveToDisk.
  • It works locally but not in CI: record Firefox and Selenium versions, preserve the same Firefox preferences, and inspect the absolute output location used by the job.

Or skip the browser setup

If you need a rendered website screenshot rather than the image file itself, ScreenshotNeo offers a screenshot API and MCP server. A single GET request can return a PNG, JPEG, WebP, or PDF. For example, using cURL:

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

See the ScreenshotNeo API documentation for request options. Cookie banners, popups, and chat widgets are removed before the shot; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots. The Free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000 screenshots. Sign up for 1,000 free screenshots a month, with no card required.

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

Frequently asked questions

Can Selenium save an image as JPEG or WebP with its screenshot method?

The documented screenshot methods described here write PNG output. For an original JPEG or WebP, download the server response rather than treating a screenshot as the source file.

Does an element screenshot include CSS effects?

It captures the rendered element, so it represents the browser’s displayed result rather than guaranteeing the original image bytes or an unstyled source asset.

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.