Use Playwright for Python to open product-page URLs in a browser, capture the viewport, full page, or a specific element, and save each result under a stable filename. For a reliable batch, read URLs and item IDs from a CSV, wait for a site-appropriate ready condition, and record each success or failure in a manifest. Playwright supplies the browser and screenshot operations; it does not guarantee that every ecommerce site will load or permit automated access.
What you need before capturing a batch
- Python and Playwright for Python, plus one of Playwright’s supported browser engines: Chromium, Firefox, or WebKit.
- A CSV containing a stable item ID and the full product-page URL for each intended capture.
- A folder for screenshots and a manifest that records the URL, output path, and result for each row.
- A capture goal: consistent above-the-fold previews, full-page product details, or a specific element such as a product image or price.
Check the target site’s current terms and use an authorized access method before running automation. Consent handling, localization, login state, dynamic content, and access behavior vary by site. Playwright’s general documentation does not establish the current automation policy or behavior of Amazon.in, Flipkart, or another Indian marketplace.
Install Playwright and its browser
In a terminal, install the Python package and then install the browser engine you plan to use. This example uses Chromium:
python -m pip install playwrightpython -m playwright install chromium
The script below uses Playwright’s synchronous Python interface. Playwright also provides an asynchronous interface; choose it if the surrounding application already uses asyncio or you need to coordinate asynchronous work.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Prepare the input CSV
Save a file named products.csv with these column headers and one product per row:
id,urlsku-001,https://example.com/product/onesku-002,https://example.com/product/two
Use an ID that is unique and stable for your own records. The script sanitizes IDs for filenames, rather than relying on page titles, which can be missing or duplicated. Replace the example URLs with the product URLs you are permitted to access.
Run a batch capture with Python
This complete script writes one PNG per row and a manifest.csv containing each requested URL, output path, and status. It captures full pages by default, waits for the page load event and then a short configurable delay, and continues to the next row after an individual error.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
import csv
import re
from pathlib import Path
from playwright.sync_api import sync_playwright
INPUT_CSV = Path("products.csv")
OUTPUT_DIR = Path("screenshots")
MANIFEST = OUTPUT_DIR / "manifest.csv"
VIEWPORT = {"width": 1440, "height": 1000}
FULL_PAGE = True
POST_LOAD_WAIT_MS = 1000
NAVIGATION_TIMEOUT_MS = 30000
def safe_filename(value: str) -> str:
"""Keep filenames predictable and remove path separators or unsafe characters."""
cleaned = re.sub(r"[^A-Za-z0-9._-]+", "_", value.strip())
cleaned = cleaned.strip("._-")
return cleaned or "unnamed"
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
with INPUT_CSV.open("r", newline="", encoding="utf-8-sig") as source:
rows = list(csv.DictReader(source))
manifest_rows = []
seen_names = set()
with sync_playwright() as p:
browser = p.chromium.launch(headless=True)
page = browser.new_page(viewport=VIEWPORT)
page.set_default_navigation_timeout(NAVIGATION_TIMEOUT_MS)
for index, row in enumerate(rows, start=1):
item_id = (row.get("id") or "").strip()
url = (row.get("url") or "").strip()
filename_id = safe_filename(item_id or f"row-{index:04d}")
filename = f"{filename_id}.png"
output_path = OUTPUT_DIR / filename
status = "error"
detail = ""
if not url:
detail = "Missing URL"
elif filename in seen_names:
detail = "Duplicate sanitized ID; use unique IDs in the CSV"
else:
seen_names.add(filename)
try:
response = page.goto(url, wait_until="load")
page.wait_for_timeout(POST_LOAD_WAIT_MS)
page.screenshot(path=str(output_path), full_page=FULL_PAGE)
status = "ok"
detail = f"HTTP {response.status}" if response else "Navigation completed without a response object"
except Exception as exc:
detail = f"{type(exc).__name__}: {exc}"
manifest_rows.append({
"id": item_id,
"url": url,
"screenshot": str(output_path) if status == "ok" else "",
"status": status,
"detail": detail,
})
browser.close()
with MANIFEST.open("w", newline="", encoding="utf-8") as output:
writer = csv.DictWriter(
output,
fieldnames=["id", "url", "screenshot", "status", "detail"],
)
writer.writeheader()
writer.writerows(manifest_rows)
print(f"Processed {len(manifest_rows)} rows. Manifest: {MANIFEST}")
Save it as capture_products.py and run python capture_products.py. Successful image files appear in screenshots/; inspect screenshots/manifest.csv to find rows that need attention. The wait time is a starting point, not a universal readiness guarantee: a store may render product data after the load event or use site-specific client-side behavior.
Choose the screenshot scope
Viewport preview
To produce consistent previews of the initially visible layout, set FULL_PAGE = False. By default, page.screenshot() captures the current viewport. Keep the viewport dimensions fixed across a batch when the goal is visual comparison.
Full scrollable page
Set FULL_PAGE = True to request a screenshot of the full scrollable page, including below-the-fold content. This can be useful for product details and reviews, but pages with long or dynamically loaded content may need a site-specific wait or scrolling strategy before capture.
One element
For a product card, price block, or other identified component, use a locator screenshot instead of a page screenshot. Replace the screenshot line with a selector known to match the intended element:
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsRank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
page.locator("[data-testid='product-price']").screenshot(path=str(output_path))
Choose a selector that actually exists on the target page and verify it against each site’s markup. Locator screenshots are clipped to the element’s bounds; an element obscured by another element can remain obscured in the image.
Capture to bytes for processing
If you need to compare pixels or process an image before writing it, capture bytes rather than saving directly to a path:
image_bytes = page.screenshot(full_page=FULL_PAGE)
# Pass image_bytes to your image-processing or comparison step.
Make readiness and output handling dependable
Wait for the relevant content
The example waits for the browser’s load event and then a fixed delay. Neither is proof that a product’s price, image gallery, or other client-rendered content is ready. Where a stable site-specific selector is available, wait for it before capturing, for example:
page.goto(url, wait_until="domcontentloaded")
page.locator("[data-testid='product-title']").wait_for(state="visible", timeout=15000)
page.screenshot(path=str(output_path), full_page=FULL_PAGE)
Use a selector appropriate to that store; do not assume the example selector is universal. For content that appears only after scrolling or interaction, reproduce the authorized visitor flow and verify the resulting page before treating the image as complete.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Keep a useful manifest
The sample records the requested URL, stable ID, image path, status, and error detail. For audit or review, you can extend the manifest with fields such as capture time or the final page URL, but keep the original input URL so redirects and unexpected navigation are detectable.
Handle duplicate IDs deliberately
The script flags IDs that sanitize to the same filename rather than overwriting an earlier image. Correct the CSV to use unique IDs before rerunning. This matters when distinct IDs contain characters that are removed during filename sanitization.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Browser and workflow choices
Chromium, Firefox, or WebKit
Playwright documents Chromium, Firefox, and WebKit browser engines. This example launches Chromium; use another supported engine when your intended environment calls for it. Browser choice can affect rendering, so use the same engine and viewport for captures you plan to compare.
Local browser or managed capture
A local Playwright process gives you control over the browser workflow and lets you adapt waits and selectors to a target page. A managed screenshot service is an alternative operating model when you do not want to provision browser automation yourself; verify that its behavior fits your access requirements and output needs.
Free tools Windows power users keep installed
One-click scans. No signup required.
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Troubleshoot common batch failures
- Browser executable not found: the Python package is installed but the browser is not. Run
python -m playwright install chromium, or install the engine selected in your script. - Navigation timeout: the page did not reach the selected navigation event within the configured timeout. Check the URL and connectivity, and consider a suitable less restrictive navigation event only if your readiness checks then wait for the content you need.
- Screenshot is blank or incomplete: a page load event may occur before the product content is rendered. Wait for a site-specific visible selector and inspect whether content requires scrolling or another authorized interaction.
- Element locator times out: the selector may not exist on that page, may be wrong for that store, or the target may not have become visible. Inspect the page and adapt the selector; do not silently substitute an unrelated element.
- Unexpectedly overwritten or missing files: check the manifest for duplicate sanitized IDs, missing URLs, and rows marked as errors. Give every input row a unique stable ID before retrying.
- Consent banner, popup, or chat widget covers content: the example does not remove overlays. Verify the site’s permitted consent flow and adapt the browser actions only where authorized; inspect the final image rather than assuming the page is unobstructed.
- Some product pages fail while others work: access rules, localization, authentication, and dynamic behavior may differ across sites or pages. Review each failed manifest entry and check the target site’s current terms rather than assuming a single script works everywhere.
Performance, reliability, and cost considerations
The sample reuses one browser and page sequentially, keeping the control flow and output association straightforward. It makes no throughput promise: actual completion time depends on navigation and page behavior, and the available documentation does not establish a benchmark for Indian ecommerce sites. If you change the workflow to run pages concurrently, keep output filenames unique, bound concurrency, and confirm that the target’s rules permit your request pattern.
Failures are recorded per row so a single problematic URL does not discard the rest of the batch. Review and retry failed entries selectively. No universal site coverage, reliability rate, or cost comparison can be inferred from Playwright’s screenshot API; local resource use and any managed-service charges depend on the operating model you choose.
Or skip the browser setup
ScreenshotNeo offers a website screenshot API and MCP server. Send one GET request with a URL to receive a PNG, JPEG, WebP, or PDF. For a product page, this cURL example saves a WebP image; replace the URL with the page you are authorized to capture. See the ScreenshotNeo documentation for request options.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com/product/one -o shot.webp
ScreenshotNeo accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and each response identifies the page verdict and billing status in headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools 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. These are product-plan terms, not a guarantee that a particular marketplace permits automated access.
Sign up for ScreenshotNeo’s free plan: 1,000 screenshots a month, no card required.
Frequently Asked Questions
Can the batch script save JPEG or WebP instead of PNG?
Yes. Change the output filename extension and pass the matching type value to page.screenshot(), such as type="jpeg" or type="webp". Check the Playwright screenshot documentation for the options supported by your installed version.
Does a successful screenshot mean the marketplace permits automated capture?
No. Browser automation capability does not establish a site’s current terms or access policy. Check the target site’s rules and use an authorized access method.
Quick Recap
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.

