October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Redmond desk5 min

How to Screenshot a Website with Playwright in Python on Windows

A practical Windows guide to installing Playwright for Python and capturing a website viewport, full page, or individual element.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install Playwright for Python, install its browser binaries, then open a page and call page.screenshot(). Use full_page=True for the whole scrollable document or a locator’s screenshot() method for one element. The guide below uses Playwright’s synchronous API, then covers async use, Windows-specific setup, output choices, and common fixes.

Install Playwright and its browsers on Windows

The Python package and browser binaries are separate. In PowerShell, run:

python -m pip install --upgrade pip
python -m pip install playwright
playwright install

If PowerShell cannot find the playwright command, run the installer through Python instead:

python -m playwright install

Playwright’s installation guide lists Python 3.8 or later and Windows 11 or later, Windows Server 2019 or later, or WSL among supported environments. Check the current installation requirements if you use an older Windows release or a managed environment.

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

Take a website screenshot with synchronous Python

Save this as screenshot_site.py and run python screenshot_site.py. It opens Chromium, navigates to the target, saves a viewport screenshot, and closes the browser even if an error occurs.

from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch()
    try:
        page = browser.new_page()
        page.goto("https://example.com", wait_until="load")
        page.screenshot(path="screenshot.png")
    finally:
        browser.close()

The output path is relative to the process’s current working directory. To save to a specific Windows location, use a raw string such as r"C:UsersYourNamePicturessite.png" or escape the backslashes.

Choose what to capture

Visible viewport

The default page.screenshot() captures the current viewport. Set the viewport before navigation if you need predictable dimensions:

Rank #2
Dell Latitude 3190 11.6" HD 2-in-1 Touchscreen Laptop Intel N5030 1.1Ghz 4GB Ram 128GB SSD Windows 11 Professional (Renewed)
  • 1.1 GHz (boost up to 2.4GHz) Intel Celeron N5030 Quad-Core
  • 4GB DDR4 System Memory; 128GB Solid State Drive
  • 11.6" HD (1366 x 768) Multi-Touch Display
  • Combo headphone/microphone jack - Noble Wedge Lock slot - HDMI; 2 USB 3.1 Gen 1
  • Windows 11 Pro
page.set_viewport_size({"width": 1440, "height": 900})
page.goto("https://example.com")
page.screenshot(path="viewport.png")

Full scrollable page

Pass full_page=True to capture the full scrollable document in one tall image:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
page.screenshot(path="full-page.png", full_page=True)

For pages that load images or other content only as you scroll, a full-page capture may not trigger every lazy-loaded item. If the result omits content, scroll through the page first or otherwise wait for that page’s content to load before capturing.

One element

Use a locator when you need just a component, such as a header or product card. Locator screenshots are preferable to the discouraged ElementHandle screenshot API:

Rank #3
Dell Latitude 5420 14" FHD Business Laptop Computer, Intel Quad-Core i5-1145G7, 16GB DDR4 RAM, 256GB SSD, Camera, HDMI, Windows 11 Pro (Renewed)
  • 256 GB SSD of storage.
  • Multitasking is easy with 16GB of RAM
  • Equipped with a blazing fast Core i5 2.00 GHz processor.
page.locator(".header").screenshot(path="header.png")

The locator must match an element that is present and visible. To make a capture less sensitive to animation, disable animations:

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

Keep the image in memory

Omit path when you want the screenshot bytes for image processing or comparison instead of writing a file:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
image_bytes = page.screenshot(full_page=True)

See Playwright’s screenshot guide for screenshot options such as format, clipping, and image quality.

Rank #4
15.6 Inch Laptop Computer, N4020, 4GB DDR4 RAM, 128GB eMMC,with Windows 11
  • EFFORTLESS EVERYDAY PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 Home system, delivering reliable, low-power efficiency for daily tasks like document editing, email, online classes, and web browsing
  • 15.6-INCH FULL HD DISPLAY: Enjoy immersive visuals on the 15.6" FHD (1920x1080) anti-glare screen with micro-edge bezels. Delivers clear details and comfortable viewing for long study sessions, working on spreadsheets, and video playback
  • RESPONSIVE MULTITASKING & STORAGE: Built with 4GB LPDDR4 RAM and 128GB eMMC storage for smooth daily essential use. Expand your storage by up to 1TB via the integrated TF card slot to easily store movies, photos, and working files
  • ADVANCED CONNECTIVITY: Outfitted with 2x Full-Featured Type-C ports for data transfer, fast charging, and dual-monitor output, alongside 2x USB 3.2 Gen1 ports and a 3.5mm audio jack for complete peripheral compatibility
  • LIGHTWEIGHT & SILENT OPERATION: Slim and portable for effortless travel or commuting. Features a 1MP HD webcam for remote meetings, 38Wh battery with 45W Type-C fast charging, and a fanless silent design for peaceful work environments.

Use the asynchronous API

For an async application, use async_playwright and await browser and page operations:

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", wait_until="load")
            await page.screenshot(path="screenshot.png", full_page=True)
        finally:
            await browser.close()

asyncio.run(main())

On Windows, Playwright’s async subprocess use requires a Proactor event loop. Python 3.8 and newer uses it by default; if a framework or application has replaced the default loop and Playwright reports a subprocess or event-loop error, check and restore the Proactor loop. The Playwright library guide documents the Windows async requirement.

Browser choices, versions, and Windows storage

Playwright can launch Chromium, Firefox, or WebKit. Chromium is used in the examples; choose another engine when your testing or rendering target calls for it. If Microsoft Edge is installed, you can select its channel through Chromium:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
15.6 Inch Win 11 Laptop Computer, N4020, 4GB DDR4 RAM, 128GB Storage
  • WINDOWS 11 | STABLE PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 system, this laptop delivers stable performance for everyday computing tasks. It supports web browsing, online learning, document editing, email communication, and basic office work with optimized power efficiency, providing a practical and reliable experience for essential daily use for daily use.
  • 15.6” FHD IPS DISPLAY: Features a 15.6-inch Full HD IPS display with narrow bezels, offering wider viewing angles and clearer image details compared to standard panels. The improved screen-to-body ratio enhances visual experience for study, reading, document work, and video playback, making it suitable for both productivity and entertainment use.
  • 4GB DDR4 + 128GB eMMC STORAGE: Equipped with 4GB DDR4 memory and 128GB eMMC storage for everyday basics such as browsing, documents, email, and online learning platforms. The built-in TF card slot supports storage expansion up to 1TB, giving you more flexibility for files, photos, videos, and daily documents. TF card not included.
  • CONNECTIVITY & PORTS: Includes 1× TF card slot, 2× USB 3.2 Gen1 ports, and 2× full-featured Type-C ports (USB 3.2 Gen1). The Type-C ports support data transfer, charging, and video output, enabling flexible connection with external devices such as monitors, storage, and peripherals for daily work and study use.
  • LIGHTWEIGHT DESIGN | ONLINE COMMUNICATION: Designed with a slim, portable profile, this laptop is easy to carry for school, commuting, and travel. A built-in 1MP front camera supports online classes, video meetings, remote communication, and everyday conferencing. The 3300mAh battery works with the low-power system design to support practical daily use, while thermal optimization helps maintain quieter operation during extended tasks.
browser = p.chromium.launch(channel="msedge")

Browser binaries are tied to Playwright releases. The Playwright documentation notes, “Each version of Playwright needs specific versions of browser binaries to operate.” After updating the Python package, run playwright install (or python -m playwright install) if the required browser revision is missing. The default Windows browser cache is %USERPROFILE%AppDataLocalms-playwright. Details are in the official browser documentation.

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

Wait for the right page state

A screenshot reflects the page state at capture time. page.goto() can wait for different navigation milestones; the examples use wait_until="load". For pages that render important content after the initial load, wait for a meaningful selector rather than relying only on a fixed delay:

page.goto("https://example.com", wait_until="load")
page.locator("main article").wait_for(state="visible")
page.screenshot(path="article.png")

Choose a selector that is specific to the content you need. Waiting for an element that never appears will time out; handle that as a page-specific failure rather than saving a misleading partial capture.

Troubleshooting

  • Browser executable missing: Install the browser binaries for the same Python environment that runs your script with python -m playwright install. The package and browsers are installed separately, and browser revisions track Playwright releases.
  • PowerShell cannot find playwright: Use python -m playwright install so the CLI runs through that Python interpreter.
  • Async subprocess or event-loop error: On Windows, confirm the app uses a Proactor event loop. Python 3.8+ selects it by default unless application or framework code overrides it.
  • Screenshot saved in an unexpected folder: A relative path is resolved from the process working directory. Use an absolute path, with a raw string or escaped backslashes, to choose a known destination.
  • Only the visible portion appears: Set full_page=True for the whole scrollable page. For one component, use page.locator("selector").screenshot(...).
  • Element capture is unstable: Disable animations with animations="disabled" in the locator screenshot call. If an element is missing, first wait for its locator to become visible.
  • Full-page output misses deferred images: Scroll through the page or wait for lazy content to load before taking the full-page capture; full-page sizing alone does not guarantee every site has fetched deferred assets.
  • Navigation times out or shows an incomplete page: Check whether the page needs a different readiness condition or a longer timeout, and wait for the specific content you intend to capture. A page can continue rendering after its initial load event.

Or skip the browser setup

If you do not want to install and maintain browser binaries, ScreenshotNeo offers a website screenshot API and MCP server. One GET request returns an image or PDF; the example below saves a WebP screenshot:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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. ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each of those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for AI agents and MCP clients. The free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 shots. Learn about ScreenshotNeo or sign up free for 1,000 screenshots a month with no card.

Frequently Asked Questions

Can Playwright save a screenshot as a PDF?

Yes. Use the page PDF API for PDF output; the ScreenshotNeo request shown above can also return a PDF.

Can I capture with Firefox or WebKit instead of Chromium?

Yes. Playwright supports Chromium, Firefox, and WebKit; install the required browser binaries and launch the corresponding browser type.

Quick Recap

Bestseller No. 1
HP 14' HD Laptop, Windows 11, Intel Celeron Dual-Core Processor Up to 2.60GHz, 4GB RAM, 64GB SSD, Webcam, Dale Pink (Renewed)
HP 14" HD Laptop, Windows 11, Intel Celeron Dual-Core Processor Up to 2.60GHz, 4GB RAM, 64GB SSD, Webcam, Dale Pink (Renewed)
14" diagonal, 1366x768 resolution, HD BrightView LED, Glossy NON-TOUCH Display
$245.99
Bestseller No. 2
Dell Latitude 3190 11.6' HD 2-in-1 Touchscreen Laptop Intel N5030 1.1Ghz 4GB Ram 128GB SSD Windows 11 Professional (Renewed)
Dell Latitude 3190 11.6" HD 2-in-1 Touchscreen Laptop Intel N5030 1.1Ghz 4GB Ram 128GB SSD Windows 11 Professional (Renewed)
1.1 GHz (boost up to 2.4GHz) Intel Celeron N5030 Quad-Core; 4GB DDR4 System Memory; 128GB Solid State Drive
Bestseller No. 3
Dell Latitude 5420 14' FHD Business Laptop Computer, Intel Quad-Core i5-1145G7, 16GB DDR4 RAM, 256GB SSD, Camera, HDMI, Windows 11 Pro (Renewed)
Dell Latitude 5420 14" FHD Business Laptop Computer, Intel Quad-Core i5-1145G7, 16GB DDR4 RAM, 256GB SSD, Camera, HDMI, Windows 11 Pro (Renewed)
256 GB SSD of storage.; Multitasking is easy with 16GB of RAM; Equipped with a blazing fast Core i5 2.00 GHz processor.
$285.00

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.

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

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.