October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Redmond desk7 min

How to Take Bulk Screenshots of URLs with Python on Windows

A practical Windows walkthrough for bulk URL screenshots with Python and Playwright, including installation, a sequential script, capture choices, and troubleshooting.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Playwright for Python: install the package and Chromium, then open one browser and visit each URL in a loop, saving each screenshot under a unique filename. Start with the sequential script below; it is straightforward to troubleshoot and can log failures without stopping the rest of the batch.

Set up Playwright on Windows

Run these commands in PowerShell from the folder where you want to keep the project. A virtual environment keeps this installation separate from other Python projects.

As an Amazon Associate I earn from qualifying purchases.

py -m venv .venv
..venvScriptsActivate.ps1
python -m pip install --upgrade pip
python -m pip install playwright
python -m playwright install chromium

Playwright needs both its Python package and browser binaries. Installing Chromium alone is sufficient for the script below; the general install command, python -m playwright install, downloads the supported browser engines. Playwright’s default Windows browser cache is %USERPROFILE%AppDataLocalms-playwright. See the Playwright Python installation guide and browser documentation.

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.

Prepare the URL list and run a sequential batch

1. Create urls.txt

Put one complete URL on each line. Blank lines and lines beginning with # are ignored by this example.

#1 Best Overall
https://example.com
https://www.python.org
# Add more URLs below

2. Save and run the script

Save this as bulk_screenshots.py in the same folder as urls.txt, then run python bulk_screenshots.py. It creates a screenshots directory, names files in input order, prints an HTTP status when available, and continues to the next URL if one capture fails.

from pathlib import Path
from playwright.sync_api import sync_playwright

urls = [
    line.strip()
    for line in Path("urls.txt").read_text(encoding="utf-8").splitlines()
    if line.strip() and not line.lstrip().startswith("#")
]
out = Path("screenshots")
out.mkdir(exist_ok=True)

with sync_playwright() as p:
    browser = p.chromium.launch()
    try:
        for index, url in enumerate(urls, start=1):
            page = browser.new_page(viewport={"width": 1440, "height": 900})
            try:
                response = page.goto(url, wait_until="load", timeout=30_000)
                page.screenshot(path=str(out / f"{index:04d}.png"), full_page=True)
                print(index, response.status if response else "no HTTP response", url)
            except Exception as exc:
                print("FAILED", index, url, repr(exc))
            finally:
                page.close()
    finally:
        browser.close()

The browser is launched once and reused, while each URL gets a fresh page that is closed even if navigation or capture raises an error. The 30_000 timeout is in milliseconds. The numbered filenames are safe and deterministic for a given input order; keep the URL list with the output so you can map each image to its source. The sample is a practical composition of Playwright’s documented navigation and screenshot APIs, not a performance benchmark. See the Python library guide and the screenshot guide.

Choose what each screenshot should contain

  • Viewport: omit full_page=True to capture only the configured 1440 × 900 viewport.
  • Full page: keep full_page=True to capture the scrollable page as one image. Long pages may produce very tall files.
  • One element: replace page.screenshot(...) with page.locator("CSS_SELECTOR").screenshot(path=str(out / f"{index:04d}.png")), substituting a selector such as main or #report.
  • Process the image in memory: omit path from page.screenshot(); Playwright returns screenshot bytes for downstream processing or pixel comparison.

Choose a viewport when outputs need consistent dimensions, full-page capture when the whole document matters, and an element capture when the page contains a specific component of interest. A selector that matches no element will cause the element capture to fail, so confirm the selector against the target page.

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.

Decide how to handle browser choice and timing

Chromium or a branded browser

The example uses Playwright’s bundled Chromium. Playwright also supports Firefox and WebKit. If the result needs to match branded Chrome or Microsoft Edge, its browser documentation describes launching installed branded browsers through channels such as msedge; those branded browsers are not installed by Playwright by default. Confirm the channel and any enterprise policies on the Windows machine where the batch runs, and use the browser whose rendering is relevant to your task.

Load state and timeout

The sample waits for the page’s load event. A page can continue changing after that event, especially when it loads data dynamically. If the screenshot must include a particular component, wait for that component before capturing; if the page is still loading after 30 seconds, the navigation raises an error and the script logs it before moving on. Choose a wait condition and timeout based on what the target pages actually need rather than assuming every site behaves alike.

Rank #2
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.

Scale up carefully: sequential first, bounded concurrency second

Sequential capture is easier to inspect because it visits one URL at a time and uses less simultaneous browser activity. For a very large URL list, asynchronous Playwright can overlap navigation waits, but concurrency increases memory and resource use and can make failures harder to diagnose. The official Playwright documentation does not prescribe a bulk concurrency limit or provide a throughput or success-rate guarantee. Measure with representative URLs on the actual computer, begin with a small concurrency bound, and increase it only while resource use and output quality remain acceptable.

For async Python on Windows, Playwright runs its driver in a subprocess and requires ProactorEventLoop; SelectorEventLoop does not support async subprocesses. The Playwright Python documentation notes that ProactorEventLoop is the default on Python 3.8 and later, so most users should not need to change the event loop manually. See Playwright’s Python library documentation.

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

Make batch results auditable and recoverable

  • Keep each image mapped to its input URL. Numbered files are simple; for repeat runs where URL order changes, consider recording a CSV manifest with filename, URL, status and error.
  • Log HTTP status when a response object exists. A missing response object is not by itself proof that no screenshot was produced.
  • Decide whether failed URLs should be retried. The script reports failures but does not retry automatically; retries are an application policy, not a documented Playwright bulk guarantee.
  • Check output dimensions and file sizes. Full-page captures can be much taller and larger than viewport images.
  • Do not promise a fixed pages-per-minute rate. Site complexity, network conditions, browser choice and machine resources affect the result; measure your own workload.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common failures

PowerShell will not activate .venv

Activation may be blocked by the PowerShell execution policy. You can either use a policy appropriate to your environment or skip activation and invoke the environment’s interpreter directly with .venvScriptspython.exe -m pip install playwright and .venvScriptspython.exe bulk_screenshots.py.

Playwright reports that a browser executable is missing

The package may be installed without its browser binaries. Run python -m playwright install chromium using the same Python environment that runs the script. If the cache location was customized or the job runs under a different Windows user, ensure that account can access the installed browser files.

A URL times out or navigation fails

Check that the URL includes its scheme, such as https://, and that the machine can reach the site. Slow pages may need a longer timeout or a more appropriate wait condition. The per-URL exception handler prints the failure and allows later URLs to continue.

Rank #3
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.

The image is blank, incomplete or missing late-loaded content

The page may render important content after the load event. Wait for a relevant selector or use a task-appropriate delay before taking the screenshot. Verify the chosen capture mode too: viewport capture will not include content outside the viewport, whereas full-page capture produces a tall image.

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

Element capture fails

Check the CSS selector and whether the element appears only after interaction or delayed rendering. Wait for the locator to become available before calling its screenshot method.

A status code looks like an error but an image exists

The sample records the HTTP response status as diagnostic metadata; it does not decide whether a response status is acceptable for your use case. Inspect the page and define an explicit policy for which statuses to keep, flag or retry.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server for developers. One GET request can return an image or PDF, without installing Playwright or browser binaries locally. Cookie and consent banners, newsletter popups and chat widgets are removed before capture; bot checks, blank pages and failed loads are not billed. AI agents can use its MCP server, and 1,000 screenshots per month are free with no card; paid plans start at $5 for 3,000 screenshots. The service also supports full-page and element captures, browser and viewport options, wait conditions, custom headers and cookies, and bulk requests of up to 100 URLs per call. See the ScreenshotNeo API documentation.

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

For the response formats, options and request details, consult the ScreenshotNeo documentation. 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 I use the same script for a list of URLs from a CSV file?

Yes. Read the URL column from the CSV instead of reading lines from urls.txt, while retaining a filename-to-URL mapping so each output remains traceable.

Does Playwright guarantee that every URL will produce a screenshot?

No. Navigation, network and page behavior can fail; the sample logs per-URL errors so a failed page does not stop the remaining batch.

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

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
Crashes, No Sound, or Screen Glitches?Free driver scan

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.