Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk8 min

Bulk Website Screenshot Generation in Python for Indian Ecommerce Product Pages

Use Playwright for Python to batch-capture Indian ecommerce product pages from a CSV, choose viewport or full-page screenshots, and log outcomes in a manifest.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Python with Playwright to read product URLs from a CSV, capture each page at a consistent scope, and record each result in a manifest. The key decisions are what to capture—viewport, full page, or a specific element—and what counts as “ready” on each target site. Playwright provides the browser and screenshot operations; the CSV loop, filenames, waits, and error handling are your batch workflow.

What you need to decide before batching

First choose a capture scope that matches the comparison you want to make:

As an Amazon Associate I earn from qualifying purchases.

  • Viewport: captures the currently visible browser area, useful for consistent previews of the initial layout.
  • Full page: use full_page=True to capture the full scrollable page, including below-the-fold product details.
  • Element: capture a located component, such as a product card or price section. The image is clipped to the element’s bounds, but other content may still obscure it.
  • Image bytes: capture to memory when you plan to process or compare pixels before saving.

Playwright documents these screenshot modes and supports Chromium, Firefox, and WebKit. Pick one browser engine and viewport for a batch when you need consistent outputs; do not assume that the same page will render identically across engines.

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

Prepare the URL list

Create a CSV with a stable identifier for each requested page. Use IDs—not page titles—for filenames: titles may be missing, duplicated, or changed by the site. For example, save this as products.csv:

id,url
sku-1001,https://example.in/products/item-one
sku-1002,https://example.in/products/item-two

Replace the example URLs with pages you are authorized to access. The ID becomes the predictable image name, and the manifest will associate that file with its requested URL and result.

Install Playwright and its browser

  1. Install the Python package: python -m pip install playwright.
  2. Install a browser engine, for example Chromium: python -m playwright install chromium.
  3. Save the batch script below beside products.csv, then run it with python capture_products.py.

Playwright’s getting-started guide documents the browser launch, navigation, and screenshot sequence: Playwright for Python: Getting started.

Runnable Python batch script

This example uses Chromium, a fixed viewport, a per-row output filename, and a JSON Lines manifest. It captures the viewport by default. Set FULL_PAGE to True for complete scrollable pages. The readiness wait is a configurable delay, not a universal guarantee that a store has finished rendering.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
The Standards Real Book, C Version
  • Used Book in Good Condition
import csv
import json
import re
from pathlib import Path
from urllib.parse import urlparse

from playwright.sync_api import sync_playwright

INPUT_CSV = Path("products.csv")
OUTPUT_DIR = Path("screenshots")
MANIFEST = Path("manifest.jsonl")
FULL_PAGE = False
VIEWPORT = {"width": 1440, "height": 1000}
WAIT_MS = 1500


def safe_id(value: str) -> str:
    cleaned = re.sub(r"[^A-Za-z0-9_-]+", "_", value.strip())
    return cleaned.strip("_") or "item"


def valid_http_url(value: str) -> bool:
    parsed = urlparse(value)
    return parsed.scheme in {"http", "https"} and bool(parsed.netloc)


OUTPUT_DIR.mkdir(parents=True, exist_ok=True)

with INPUT_CSV.open("r", newline="", encoding="utf-8-sig") as csv_file, 
        MANIFEST.open("w", encoding="utf-8") as manifest_file, 
        sync_playwright() as playwright:
    rows = csv.DictReader(csv_file)
    if not rows.fieldnames or not {"id", "url"}.issubset(rows.fieldnames):
        raise ValueError("CSV must have columns named id and url")

    browser = playwright.chromium.launch()
    try:
        page = browser.new_page(viewport=VIEWPORT)
        for row_number, row in enumerate(rows, start=2):
            item_id = (row.get("id") or "").strip()
            url = (row.get("url") or "").strip()
            record = {
                "row": row_number,
                "id": item_id,
                "url": url,
                "status": "failed",
                "file": None,
                "error": None,
            }

            try:
                if not item_id:
                    raise ValueError("Missing id")
                if not valid_http_url(url):
                    raise ValueError("URL must be an absolute http or https URL")

                response = page.goto(url, wait_until="domcontentloaded", timeout=60000)
                # Tune this for the target site, or replace it with a site-specific
                # locator wait when a reliable product-page element is known.
                page.wait_for_timeout(WAIT_MS)

                filename = OUTPUT_DIR / f"{safe_id(item_id)}.png"
                page.screenshot(path=str(filename), full_page=FULL_PAGE)
                record["status"] = "success"
                record["file"] = str(filename)
                record["http_status"] = response.status if response else None
            except Exception as exc:
                record["error"] = f"{type(exc).__name__}: {exc}"
            finally:
                manifest_file.write(json.dumps(record, ensure_ascii=False) + "n")
                manifest_file.flush()
        browser.close()
    finally:
        if browser.is_connected():
            browser.close()

The script expects a header row containing id and url. It writes one PNG per valid row under screenshots/ and one JSON object per input row to manifest.jsonl. A failed navigation or capture is recorded as a failure rather than silently counted as an image. The recorded HTTP status is the navigation response status, not proof that all page content loaded correctly.

Make readiness site-specific

domcontentloaded means the initial document has been parsed; it does not guarantee that product images, prices, variants, or client-rendered content are ready. The example adds a short delay only as a starting point. For a known page structure, prefer waiting for a meaningful element, such as a product title or price:

page.goto(url, wait_until="domcontentloaded", timeout=60000)
page.locator("[data-testid='product-title']").wait_for(state="visible", timeout=15000)
page.screenshot(path=str(filename), full_page=True)

The selector is illustrative: inspect the target page and replace it with an element that actually exists there. If pages load content as the user scrolls, a full-page screenshot may not cause every lazy-loaded image to appear. Validate the resulting captures for each site and capture scope.

Capture one element or image bytes

Capture a specific product component

Use a locator screenshot when the comparison is about a particular card or region rather than the whole page:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
product = page.locator(".product-details")
product.wait_for(state="visible", timeout=15000)
product.screenshot(path="screenshots/sku-1001-details.png")

Replace .product-details with a selector verified on the target page. Locator screenshots are bounded to the element; an overlapping banner or floating widget may still cover part of it.

Capture into memory for processing

image_bytes = page.screenshot(full_page=True)
# Pass image_bytes to your image-processing or comparison code.

When you do not pass a path, Playwright returns the screenshot as bytes. This is useful if the next stage is image processing or pixel comparison rather than immediate file output.

Run responsibly on Indian ecommerce sites

Playwright’s API documentation describes browser behavior; it does not establish the current terms, access rules, or automation behavior of Amazon.in, Flipkart, or any other Indian marketplace. Check each target site’s current terms and use an authorized access method before running a batch. Site behavior can also vary with consent choices, localization, login state, dynamic content, and access checks. Validate a small permitted sample and review the images and manifest before increasing the batch.

Rank #4
NQUO Rental Billing Software (Unit Pos)
  • FOR Small Facility, Complex, Housing, Arcade
  • ONE-TIME-PURCHASE; Small Investment
  • TOTAL 63 Features (Modules, 22 Reports)
  • Unit, Staff; Member Maintenance & Reporting
  • Request Trial, Try Features & Decide !

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. A single GET request can return a PNG, JPEG, WebP, or PDF. Its API accepts common screenshot parameter names used by other screenshot APIs, which can make switching easier. For a bulk workflow, you still need to iterate over your URL list and store each response with your own stable ID and outcome record.

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

Example cURL request, adapting the URL to the product page you are authorized to capture:

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

See the ScreenshotNeo API documentation for request options and response details. Cookie/consent banners are accepted before capture and more than 60 known consent platforms, newsletter popups, and chat widgets are removed; each of these steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. An MCP server exposes take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.

Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.

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

Troubleshooting the batch

  • Browser executable missing: install the engine used by the script with python -m playwright install chromium; installing the Python package alone may not install the browser binary.
  • Navigation timeout: the page may be slow, blocked, or waiting on resources. Check the URL and access permission, and choose a readiness condition that matches the site. Do not simply increase timeouts without reviewing failed records.
  • Screenshot is blank or incomplete: the page may render content after the chosen wait, require scrolling for lazy content, or show an access/consent state. Inspect the page and tune a site-specific wait or capture process; the screenshot API alone cannot establish that the intended product content appeared.
  • Element locator times out: the selector may differ by site, be absent for that product, or remain hidden. Inspect the rendered page and use a selector for a visible, stable component.
  • Unexpectedly overwritten images: IDs must be unique after sanitization. Check for duplicate IDs in the input and adjust the naming scheme if two IDs map to the same safe filename.
  • Batch stops unexpectedly: each row’s exception is recorded, but setup failures such as missing CSV columns occur before the loop. Correct the CSV header or environment issue and rerun; review the manifest and output directory to identify completed rows.

Performance, reliability, and output review

This design reuses one browser and one page sequentially, which keeps the implementation simple and makes filenames and manifest entries easy to correlate. It does not promise a particular throughput: page size, site response, waits, browser resources, and access controls all affect completion time. Parallel pages can increase resource demand and may trigger target-site limits, so only add concurrency when you have a permitted use case and have validated the target’s behavior.

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

Review the manifest alongside the screenshots. A successful browser call means an image was saved, not that the image contains the intended product state. Check representative files for consent overlays, incomplete image loading, regional currency or language differences, and product variants before relying on the batch for comparison.

Frequently asked questions

Can I use this for product-data scraping?

This workflow captures images; it does not extract product fields into structured data. Data extraction has different technical and site-policy considerations.

Should I use Chromium, Firefox, or WebKit?

Playwright supports all three. Choose the engine that matches your comparison goal and environment, then keep it consistent within a batch.

Does the script guarantee the same screenshot for every run?

No. Page content, timing, localization, session state, and site behavior can change between runs. A fixed viewport and stable IDs improve consistency and bookkeeping but do not freeze a live website.

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.

Leave a Reply

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

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.

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
Windows Errors? Fix Them Before They SpreadFree repair scan
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.