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

In Python, navigate with Chrome WebDriver and call driver.save_screenshot('screenshot.png'). The method saves the current browser window as a PNG and returns a Boolean you can check for a file-write failure.

Capture a Chrome screenshot in Python

The smallest working Selenium flow is: create a Chrome WebDriver, open the URL, save the current window, and always quit the browser.

from selenium import webdriver

driver = webdriver.Chrome()
try:
    driver.get('https://example.com')
    saved = driver.save_screenshot('screenshot.png')
    if not saved:
        raise OSError('Could not save screenshot')
finally:
    driver.quit()

save_screenshot() writes the current window to a PNG file. Selenium documents a full path and a .png extension for the filename; it returns True when the save succeeds and False for an IOError. See the Chromium WebDriver Python API.

Replace the example URL and output path with your own values. Use an absolute path when a scheduled job, test runner, or container could have a different working directory:

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.
#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
from pathlib import Path
from selenium import webdriver

output = Path('/tmp/selenium-captures/home.png')
output.parent.mkdir(parents=True, exist_ok=True)

driver = webdriver.Chrome()
try:
    driver.get('https://example.com')
    if not driver.save_screenshot(str(output)):
        raise OSError(f'Chrome could not write {output}')
finally:
    driver.quit()

What Selenium’s screenshot call captures

The driver method captures the current browsing context (the browser window Selenium is controlling) at the moment the call runs. It is not an instruction to capture an arbitrary DOM node, and the documented API does not establish a Chrome-specific full-page image mode.

Current-window PNG file

Use driver.save_screenshot(path) when the next step is a file upload, visual-regression artifact, or human review. Check the returned Boolean if a failed write must fail the test rather than silently producing no artifact.

PNG bytes in memory

driver.get_screenshot_as_png() returns PNG data as bytes. This avoids a temporary file when you want to send the image to another library, object store, or test report.

from selenium import webdriver

with webdriver.Chrome() as driver:
    driver.get('https://example.com')
    png_bytes = driver.get_screenshot_as_png()
    # Pass png_bytes directly to code that accepts PNG bytes.

Base64-encoded image text

driver.get_screenshot_as_base64() returns Base64-encoded image text, useful when an HTML report or another interface expects an encoded string.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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
from selenium import webdriver

with webdriver.Chrome() as driver:
    driver.get('https://example.com')
    encoded = driver.get_screenshot_as_base64()
    html_image = f"<img src='data:image/png;base64,{encoded}' alt='Capture'>"

Alternative file method

driver.get_screenshot_as_file(path) also writes the current window as PNG and reports success with a Boolean. Choose it when that name better matches an existing codebase; its capture scope is the same as the driver screenshot.

Capture one element instead of the whole window

When the artifact should contain only a card, chart, form, or other element, locate that element and call its screenshot method. This keeps the capture scope at the selected element rather than the current browser window.

from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException

with webdriver.Chrome() as driver:
    driver.get('https://example.com')
    try:
        panel = driver.find_element('css selector', '.pricing-panel')
    except NoSuchElementException:
        raise RuntimeError('The .pricing-panel element was not found')
    if not panel.screenshot('pricing-panel.png'):
        raise OSError('Could not save the element screenshot')

Use a selector that identifies the intended element on the page. If the selector matches nothing, Selenium cannot produce the element image; if it matches the wrong node, the file can be valid while still being the wrong artifact.

Make the capture repeatable

Navigate before capturing

Call driver.get() before the screenshot and place the capture after whatever application-specific condition means that the page is ready. For a static page, the sequence in the first example is sufficient. For a page that renders data after navigation, synchronize with your application’s own readiness signal before calling the screenshot method.

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.

Use deterministic output names

Include a run identifier, route, or timestamp in the destination when several captures are produced. Create the parent directory first and avoid relying on the process’s current working directory.

Close every browser session

Put driver.quit() in a finally block or use a context manager. This prevents an exception during navigation or saving from leaving a Chrome process behind and affecting later captures.

Current-window, element, and output choices

Method Scope Result Use it when
driver.save_screenshot(path) Current window PNG file plus Boolean success You need a file artifact and want to detect an I/O failure.
driver.get_screenshot_as_file(path) Current window PNG file plus Boolean success You prefer the explicit “as file” method name.
driver.get_screenshot_as_png() Current window PNG bytes The next operation processes the image in memory.
driver.get_screenshot_as_base64() Current window Base64 text An HTML report or API field requires encoded image data.
element.screenshot(path) Selected element Element image file plus success result You need one component rather than the entire current window.

These documented paths establish PNG output, current-window capture, and element capture. They do not by themselves establish a Chrome-specific full-page method, a guaranteed viewport size, or equivalent behavior in every headless configuration, so do not treat save_screenshot() as proof that an entire long page was captured.

Common failures and fixes

Chrome WebDriver will not start

Symptom: WebDriver raises an exception before get() runs. Cause: Chrome, the WebDriver component, or the environment is unavailable or incompatible. Fix: Verify that Chrome can launch in the same account or container as the script, that the WebDriver setup used by your Selenium installation is available, and that the process has permission to execute it. The screenshot call cannot run until the browser session is created.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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

The method returns False

Symptom: Chrome navigates successfully, but save_screenshot() reports failure. Cause: The destination cannot be written, commonly because the directory does not exist or the process lacks permission. Fix: Create the directory, pass an absolute path, check permissions, and fail the job on a false return instead of assuming a file exists.

NoSuchElementException for an element capture

Symptom: The element lookup fails. Cause: The selector does not match the current DOM at capture time. Fix: Confirm the selector against the page you opened and synchronize with the application’s render condition before looking up the element.

The image is blank or shows an intermediate state

Symptom: The file is valid but contains a loading shell, cookie prompt, or incomplete content. Cause: The screenshot was taken before the page reached the state you intended. Fix: Put the call after your page-specific readiness condition, and inspect the URL and DOM state immediately before capture.

The screenshot is the wrong scope

Symptom: You expected one component or a full document but received the current window. Cause: Driver screenshots and element screenshots are different APIs, and the documented driver method is current-window capture. Fix: Use the element method for a single node; for long-page output, choose a tool that explicitly documents full-page capture rather than assuming Selenium’s basic call provides it.

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.
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.

Base64 is displayed as an image placeholder

Symptom: An HTML report shows a broken image. Cause: The data URI is missing its media-type prefix or the string was altered during templating. Fix: Prefix the returned value with data:image/png;base64, and preserve the complete string.

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

Performance, reliability, and cost considerations

A Selenium capture includes browser startup, navigation, page rendering, and image encoding. Reuse one WebDriver session for a sequence of pages when isolation requirements allow it, and always close it at the end. Saving PNG bytes directly can remove a temporary-file step; saving to an absolute path is easier to audit in CI.

The Selenium APIs described here do not specify a per-screenshot service charge. Your practical costs are the machine or container running Chrome and the time required for each browser session. Capture size, page complexity, and your synchronization logic affect runtime, but the cited API documentation does not provide a universal benchmark.

For reliable artifacts, record the destination path, check Boolean results, retain the browser log or test context when a capture fails, and keep the URL and selector alongside the image so another run can reproduce the request.

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

Or skip the browser setup

ScreenshotNeo provides a website screenshot API and MCP server when you want one HTTP request instead of managing Chrome WebDriver. It accepts a URL and returns PNG, JPEG, WebP, or PDF. Before capture it can accept cookie or consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled.

Only clean shots are billed. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and the response identifies the result with X-Page-Verdict and X-Billed headers. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients.

One-call cURL request

See the ScreenshotNeo API documentation for request options and authentication details.

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

Node.js request

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://example.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

Options relevant to automated captures

  • Full-page capture with lazy images loaded, or one element selected by CSS selector.
  • Dark mode, 12 device presets, arbitrary viewports, and retina scale.
  • Wait for a selector, a delay, or network idle; click an element before capture; inject custom CSS or JavaScript; and hide selectors.
  • Block ads, trackers, requests, or resource types; provide custom headers, cookies, a user agent, or Authorization; and set timezone or geolocation.
  • Resize images, choose a transparent background, cache with a TTL you choose, create signed links for public <img> tags, submit asynchronous jobs with signed webhooks, capture up to 100 URLs per bulk call, and query usage through the usage API.
  • Generate PDFs with paper size, margins, landscape orientation, and page ranges. An OpenAPI specification is available, and parameter names used by other screenshot APIs also work to ease migration.

Plans

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

Every feature is on every plan, and yearly billing provides two months free. If you want to try the API rather than install and maintain a browser session, sign up for 1,000 free screenshots a month with no card. Paid plans start at $5 for 3,000 shots.

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

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.