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

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Use Playwright to loop through a URL list, read each page’s title, clean it into a filename, and save a screenshot. Add a numbered prefix so pages with identical titles do not overwrite each other. The example below uses Python and Chromium; it is assembled from documented Playwright operations, so adjust its wait strategy and filename rules for your sites and operating system.

Bulk screenshot URLs with page-title filenames

Playwright documents page navigation, retrieving a title, and saving screenshots. The bulk workflow is a loop that combines those individual operations; it is not a built-in bulk command. See the Playwright screenshots guide, Python getting started guide, and Page API.

Install Playwright and a browser

In your project environment, install the Python package and Chromium browser:

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

Run the batch script

Save this as bulk_screenshots.py and run it with python bulk_screenshots.py. Replace the example URLs with your own.

#1 Best Overall
Sandisk 2TB Extreme Portable SSD, Up to 1050MB/s, USB-C, USB 3.2 Gen 2, IP65 Water and Dust Resistance, Updated Firmware, External Solid State Drive, SDSSDE61-2T00-G25
  • Get NVMe solid state performance with up to 1050MB/s read and 1000MB/s write speeds in a portable, high-capacity drive(1) (Based on internal testing; performance may be lower depending on host device & other factors. 1MB=1,000,000 bytes.)
  • Up to 3-meter drop protection and IP65 water and dust resistance mean this tough drive can take a beating(3) (Previously rated for 2-meter drop protection and IP55 rating. Now qualified for the higher, stated specs.)
  • Use the handy carabiner loop to secure it to your belt loop or backpack for extra peace of mind.
  • Help keep private content private with the included password protection featuring 256‐bit AES hardware encryption.(3)
  • Easily manage files and automatically free up space with the SanDisk Memory Zone app.(5). Non-Operating Temperature -20°C to 85°C
from pathlib import Path
import re
from playwright.sync_api import sync_playwright

urls = [
    "https://example.com/",
    "https://www.python.org/",
]

out_dir = Path("screenshots")
out_dir.mkdir(parents=True, exist_ok=True)

def safe_stem(title: str, fallback: str) -> str:
    # Replace reserved filename characters and control characters.
    stem = re.sub(r'[<>:"/\|?*x00-x1f]', "_", title).strip(" .")
    return (stem or fallback)[:150]

with sync_playwright() as p:
    browser = p.chromium.launch()
    page = browser.new_page()

    for index, url in enumerate(urls, start=1):
        page.goto(url, wait_until="domcontentloaded")
        title = page.title()
        stem = safe_stem(title, f"page-{index:03d}")
        path = out_dir / f"{index:03d}-{stem}.png"
        page.screenshot(path=str(path), full_page=True)
        print(f"Saved {path} <- {url}")

    browser.close()

What the script does

  • page.goto() opens each URL, and page.title() reads the document title after navigation.
  • safe_stem() replaces common reserved path characters, trims trailing spaces and dots, uses a fallback for a blank title, and limits the title portion to 150 characters.
  • The numeric prefix keeps output names distinct if multiple pages have the same title. Files are written under a screenshots directory relative to the script’s current working directory.
  • full_page=True captures the full scrollable page. Remove that argument for a screenshot of the current viewport instead. The output format is inferred from the filename extension; change .png to .jpeg or another supported extension if desired.

Choose the capture wait and screenshot scope

Wait for the right page state

wait_until="domcontentloaded" waits for the document’s DOM to be parsed, but it does not guarantee that every image, script-driven component, or delayed title has finished loading. Some pages update their title or content after that point. If your captures are too early, select a wait strategy suited to the page, wait for a known selector, or add an explicit delay. Avoid assuming one wait condition is right for every site.

Viewport or full page

Use the ordinary page.screenshot() call without full_page=True for the visible viewport. Keep full_page=True when the image should cover the entire scrollable page. Long or dynamically loaded pages may need additional handling so content is present before capture.

Rank #2
Sandisk 1TB Portable SSD, Up to 800MB/s Read Speeds, Black (Old Model)
  • Solid state performance with up to 800MB/s read speeds in a portable drive. (Based on internal testing; performance may be lower depending on host device, interface, usage conditions and other factors. 1MB=1,000,000 bytes.)
  • Back up your content and memories on a storage solution that fits seamlessly into your mobile lifestyle.
  • Take it with you on your adventures—up to two-meter drop protection means this durable drive can take a beating. (Based on internal testing.)
  • Secure it to your belt loop or backpack for extra peace of mind thanks to the tough rubber hook.
  • From Sandisk, a brand professional photographers trust to take on assignments.

Browser engine and API style

The example uses Playwright’s synchronous Python API and Chromium. Playwright also documents asynchronous and synchronous patterns and other browser engines, including WebKit. Choose the browser and API style that fit your project, and install the corresponding browser runtime.

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

Make filenames safe and reliable

  • Sanitize titles. A title is arbitrary page text, not a safe path. The example replaces common reserved characters, removes control characters, and trims trailing dots and spaces. Filesystem rules differ, so review the cleanup for the systems where you will store the images.
  • Prevent collisions. The numbered prefix avoids overwrites within this run, including when different URLs share a title. If filenames must remain stable across runs even when the input order changes, use a stable URL-derived suffix rather than relying only on the index.
  • Keep names manageable. The example limits the title portion to 150 characters. Adjust it for your path-length requirements; the limit is a practical choice, not a Playwright requirement.
  • Handle changing titles. If a site sets its title only after client-side loading, wait for the relevant condition before calling page.title().
  • Consider failures per URL. A navigation failure currently stops the loop. For unattended batches, add per-URL exception handling, log the URL and error, and continue or retry according to your needs. Set a timeout policy appropriate to the sites you capture.

Troubleshoot common problems

The screenshot is blank, incomplete, or missing content

The page may not have finished loading the relevant content when the capture ran. Try a wait condition based on a page-specific selector, or wait for a known delayed component before taking the screenshot. For pages that load content as you scroll, a single full-page capture may not trigger every lazy-loaded element; determine what the target site requires before capturing.

Rank #3
SSK Portable SSD 500GB External Solid State Hard Drive USB C Up to 1050MB/s
  • Capacity Display Variance: 500GB external ssd often appears as around 465GB on Windows. MacOS can show full 500 GB capacity. This is binary calculation difference and doesn’t affect SSD hard drive actual physical storage
  • 1050 MB/s Speed: Instantly access to your files with blazing-fast 10Gbps external SSD read up to 1050MB/s and write up to 1000MB/s. LED Light indicates USB SSD instant activity
  • Data Security: Solid state drives S.M.A.R.T. health diagnostics​ and adaptive TRIM optimizing data block management ensures consistent write speeds and extends the longevity of the portable SSD
  • USB-C & USB-A Cable: Both cables featuring rapid USB 3.2 Gen2, this USB SSD effortlessly bridges devices, enabling seamless cross-platform file transfers and backup between computers, smartphones, tablets and iPhone
  • Always Fast: No slowdowns for large file transfers. With SLC caching (25% of current available capacity allocated as high-speed cache), this external SSD delivers steady 10Gbps for transfers within the cache capacity

Two pages overwrite the same file

Use a unique prefix or suffix. The script adds a sequence number for each input URL; remove that prefix only if you have another collision-safe naming scheme.

The title produces an invalid or empty name

Keep the sanitization and fallback logic. If your target filesystem has additional restrictions, add them to safe_stem(). A page without a usable title gets a name such as page-001.

Rank #4
Sale
Sandisk 1TB Extreme Portable SSD, Up to 2000MB/s Transfer Speeds-New Model
  • NEARLY 2X FASTER THAN OUR PREVIOUS GENERATION(8) – move 1,000 high-res photos in under 60 seconds(6) with up to 2000MB/s transfer speeds(2).
  • IP65 RATING AND UP TO 3M DROP PROTECTION(3) – protects against spills and drops.
  • POCKET-SIZED – fits easily in pockets and small bags.
  • SPACE TO OWN YOUR AI CONTENT – speed and capacity to download your high-res clips and photo edits.
  • 256-BIT AES ENCRYPTION(4) – helps keep private files secure with password protection.

A URL fails and the batch stops

page.goto() can fail on unreachable sites, navigation timeouts, or automation blocks. Add a try/except around each URL, record the failure, and continue to the next item if partial results are useful. Check the URL and connectivity, then tune the timeout or access requirements for that site.

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.

The output file is not in the folder you expected

The example creates screenshots relative to the process’s current working directory. Use an absolute path for out_dir if you need a fixed destination. Playwright resolves a relative screenshot path from the current working directory.

Best Value
Sale
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400)
  • Easily store and access 2TB to content on the go with the Seagate Portable Drive, a USB external hard drive
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo accepts a URL in one GET request and returns a screenshot or PDF. See the ScreenshotNeo API documentation for options and response details.

Quick Recap

Bestseller No. 2
Sandisk 1TB Portable SSD, Up to 800MB/s Read Speeds, Black (Old Model)
Sandisk 1TB Portable SSD, Up to 800MB/s Read Speeds, Black (Old Model)
From Sandisk, a brand professional photographers trust to take on assignments.
$188.90
SaleBestseller No. 4
Sandisk 1TB Extreme Portable SSD, Up to 2000MB/s Transfer Speeds-New Model
Sandisk 1TB Extreme Portable SSD, Up to 2000MB/s Transfer Speeds-New Model
IP65 RATING AND UP TO 3M DROP PROTECTION(3) – protects against spills and drops.; POCKET-SIZED – fits easily in pockets and small bags.
$259.29
SaleBestseller No. 5
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400)
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400)
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$119.99
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com/ -o shot.webp

ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status. Its MCP server provides screenshot tools for AI agents. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. See ScreenshotNeo for details, or sign up free to start with 1,000 screenshots a month and no card.

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.