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

Use Playwright’s Python API: install Playwright and its browser binaries, launch a browser, navigate to a URL, then save the page with page.screenshot(). It supports viewport, full-page, and element captures, plus PNG, JPEG, and WebP output. Playwright runs headlessly by default, so the same approach works for local scripts and CI jobs.

Install Playwright and its browser

Playwright requires both its Python package and browser binaries. Install the package in your project’s virtual environment, then run the browser installation command. The official Playwright Python guide covers supported operating systems and the installation flow.

  1. python -m pip install playwright
  2. playwright install

The second command installs the supported browser binaries, including Chromium, Firefox, and WebKit. If you only need one engine, the installation guide explains how to install a specific browser. Run the commands in the same Python environment that will execute your script.

Take a basic website screenshot

This synchronous example opens Chromium, fixes the viewport, waits for network activity to settle, and writes a PNG file:

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
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 playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch()
    page = browser.new_page(viewport={"width": 1440, "height": 900})
    page.goto("https://example.com", wait_until="networkidle")
    page.screenshot(path="example.png")
    browser.close()

Save it as screenshot.py and run python screenshot.py. Playwright’s basic workflow is launch a browser, create a page, navigate, capture, and close the browser; see the official screenshot guide. By default, Playwright runs browsers headlessly. For interactive debugging, set headless=False in p.chromium.launch().

Capture a full page or one element

Full-page screenshot

Set full_page=True to capture the full scrollable page rather than only the visible viewport:

page.screenshot(path="full.png", full_page=True)

Screenshot a specific element

Use a locator to capture a matching element, such as a header. Locator screenshots can disable animations to reduce motion-related differences:

page.locator("header").screenshot(
    path="header.png",
    animations="disabled",
)

The locator must resolve to the element you intend to capture. If it does not appear promptly, wait for the selector before taking the screenshot, for example with page.locator("header").wait_for(). The locator screenshot options are described in the screenshot guide.

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

Choose image format and capture options

page.screenshot() accepts options for format, scale, background, masking, and timeout. The Page screenshot API reference documents the available parameters.

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
Option What it controls When to use it
type Output format: "png", "jpeg", or "webp". Choose PNG for lossless output; choose JPEG or WebP when compressed output is more appropriate.
quality Compression quality for JPEG or WebP. Use only with JPEG or WebP. It does not apply to PNG.
scale "css" outputs one image pixel per CSS pixel; "device" preserves device-pixel density. Use CSS scale when output dimensions should be consistent across machines with different display density.
omit_background Omits the page background where transparency is supported. Use for transparent output; JPEG does not support transparency.
timeout Limits how long the screenshot operation may take. Set a bound appropriate to your workflow and handle timeouts explicitly.
mask Covers one or more locator-matched regions in the screenshot. Mask changing items such as timestamps or avatars when they are not part of the comparison.
style Injects CSS for the screenshot operation. Hide or normalize content that would otherwise vary between captures.

Example with WebP output and a masked dynamic region:

page.screenshot(
    path="stable.webp",
    type="webp",
    quality=80,
    mask=[page.locator(".timestamp")],
)

Confirm that the page’s selector matches real content. A mask changes what appears in the output; it does not remove the corresponding content from the website itself.

Use asynchronous Python

For applications that already use asyncio, Playwright provides an asynchronous API as well as the synchronous one:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import asyncio
from playwright.async_api import async_playwright

async def main():
    async with async_playwright() as p:
        browser = await p.chromium.launch()
        try:
            page = await browser.new_page()
            await page.goto("https://example.com")
            await page.screenshot(path="example.png")
        finally:
            await browser.close()

asyncio.run(main())

Use playwright.async_api consistently in asynchronous code; do not mix its awaited operations with the synchronous API. The Python documentation describes both API styles.

Make automated captures repeatable

For visual checks, scheduled jobs, or screenshot archives, consistency depends on controlling both browser settings and page state. A fixed viewport alone cannot make content deterministic if the site displays live data, rotating promotions, or animation.

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.
  • Fix the browser context. Use a known viewport and keep browser engine and relevant context settings consistent across runs.
  • Wait for the right state. wait_until="networkidle" can be a practical starting point, but long-polling or continuously active pages may never become idle. In those cases, wait for a meaningful selector or another readiness condition specific to the page.
  • Control motion. Disable animations in locator captures or inject CSS with the screenshot style option to normalize animated elements.
  • Mask changing regions. Use mask for timestamps, ads, avatars, or other content that is expected to vary and is irrelevant to the comparison.
  • Choose pixel scale deliberately. scale="css" keeps output dimensions tied to CSS pixels rather than a host’s device-pixel density.
  • Close reliably. In production scripts, close the browser in a finally block so exceptions do not leave browser processes running.

Run screenshots in CI or a scheduled job

Playwright’s headless default makes it suitable for environments without a visible desktop. A CI job still needs the Playwright package, the matching browser binaries, and any operating-system dependencies required by that browser. Follow the official Playwright CI guide for environment-specific setup rather than assuming a browser installed on a developer’s machine is available in the runner.

Keep capture scripts explicit about their inputs and outputs: fix the viewport, choose a readiness condition that fits the page, write predictable filenames, and return a failing process status when navigation or capture raises an error. When debugging a CI-only failure, first reproduce with the same browser engine and headless setting locally; use headless=False when a local display is available to inspect the page state.

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

Playwright or Selenium for Python screenshots?

Both can automate browser screenshots. The practical choice depends on the browser coverage and automation setup you already need.

Consideration Playwright Python Selenium Python
Browser engines Chromium, Firefox, and WebKit are documented. Depends on the configured WebDriver and browser.
API style Synchronous and asynchronous APIs are documented. Python WebDriver API.
Capture scope Viewport, full page, element, and buffer options are documented. File and full-page screenshot methods are documented.
Headless use Headless by default in Playwright’s documented usage. Supported when the browser is configured headlessly.
Natural fit Modern cross-browser screenshot automation and repeatable capture workflows. Projects already using Selenium and WebDriver.

For new screenshot automation that needs the documented browser-engine choices and both sync and async APIs, Playwright is a strong starting point. Selenium can be the lower-friction choice in an existing WebDriver estate. Driver and browser setup can change over time, so consult the current Selenium documentation before implementing environment-specific details.

Troubleshoot common failures

Playwright cannot find the browser executable

Cause: The Python package is installed, but the browser binaries are missing or were installed for a different environment. Fix: Run playwright install from the same environment used to execute the script. In CI, install browsers as part of the job setup.

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 page looks unfinished or parts are missing

Cause: The screenshot was taken before the page’s relevant content appeared, or the chosen wait condition does not represent readiness for that site. Fix: Wait for the specific content with a locator, such as page.locator("main").wait_for(), and use network-idle waiting only when the page can actually become idle.

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

Navigation hangs or times out

Cause: Some pages keep network connections active, so waiting for network idle may not complete as expected. Fix: Use a more suitable navigation wait condition and wait separately for a page-specific selector. Set navigation and screenshot timeouts to bounds that fit the task, and handle timeout exceptions so one URL does not stop an entire batch unexpectedly.

Image comparisons differ between runs

Cause: Viewport, device-pixel scale, animation, live content, or browser context differs. Fix: Fix the viewport and context, select scale="css" if consistent CSS-pixel dimensions matter, disable motion where possible, and mask intentionally variable regions.

Transparent background is absent

Cause: The selected format cannot represent transparency, or the page itself paints a background. Fix: Use a format that supports transparency rather than JPEG and set omit_background=True where supported.

A locator screenshot fails to capture the intended area

Cause: The locator does not identify the expected element, or it is not ready when capture begins. Fix: Verify the selector against the page, wait for the locator, and use the locator’s screenshot method rather than a page screenshot when the target is a single element.

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

Or skip the browser setup

If you want an API call instead of installing and maintaining a browser, ScreenshotNeo takes website screenshots through one request. The same service offers an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. Cookie banners and consent overlays, newsletter popups, and chat widgets are removed before capture; those cleanup steps can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and responses report page verdict and billing status in headers.

For example, save a screenshot of a URL as WebP with 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 parameters and response details. The API also supports PNG, JPEG, and PDF output, full-page and element captures, viewport and device settings, custom CSS and JavaScript, waits, and more. Every feature is on every plan. The Free plan includes 1,000 screenshots a month without a card; paid plans start at $5 for 3,000 screenshots. Sign up for the free plan to try it without a card.

Frequently Asked Questions

Can Playwright save a screenshot to memory instead of a file?

Yes. The screenshot API can return image bytes when you omit the path; consult the Page screenshot API reference for the buffer behavior.

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.

Can Playwright capture a PDF as well as an image?

Playwright’s screenshot method produces image output. For PDF capture, use the browser’s PDF capability where supported or a dedicated PDF capture workflow.

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.