How to Take Screenshots of an Indian Ecommerce Website with Chrome Headless
Capture an Indian ecommerce page with Chrome Headless, Puppeteer, or Playwright. Control viewport, page state, and timing for repeatable screenshots.
For one quick screenshot, run Chrome Headless with --screenshot and set the viewport with --window-size. For a full-page image or a repeatable capture, use Playwright or Puppeteer. Before capturing an Indian ecommerce page, decide which URL, viewport, language, delivery location or postcode, currency, login state, and consent or location prompts matter to your task. These choices can affect what the browser renders, but individual stores handle them differently.
1. Choose the capture method
| Need | Method | Trade-off |
|---|---|---|
| One visible viewport, with minimal setup | Chrome Headless CLI | Quick to run; the cited CLI reference documents viewport screenshots, not a full-page option. |
| Scripted navigation and capture in JavaScript | Puppeteer | Useful when navigation and capture need to be repeated or customized. |
| Full page, selected element, or device-pixel capture | Playwright | Offers explicit screenshot options for these capture scopes. |
Chrome’s current unified Headless mode runs the regular Chrome browser without a visible UI. The older Headless implementation is distributed separately as chrome-headless-shell. Use regular Chrome when rendering fidelity is the priority; the shell may suit a deployment where its lighter characteristics matter. Check the Chrome documentation for the behavior of the version you install. Chrome Headless documentation.
2. Take a viewport screenshot with the Chrome CLI
Install Chrome or Chromium in the environment where you will run the capture. The following command opens a sample Indian storefront URL and saves the visible viewport as screenshot.png in the current directory:
google-chrome --headless --screenshot --window-size=1365,900 'https://shop.example.in/'
Replace the sample URL with the page you are authorized to capture. Use a desktop-sized viewport for a desktop composition or a mobile-sized one for a mobile layout. Record the dimensions with the screenshot so future captures can be compared fairly. Chrome’s CLI example uses 412,892 for a mobile-sized viewport.
google-chrome --headless --screenshot --window-size=412,892 'https://shop.example.in/'
To keep multiple captures, choose a distinct output path or move and rename each generated screenshot.png after capture. This CLI method is appropriate for a fast, one-off viewport image. For full-page capture or control over page state and waits, use browser automation below. Chrome documents --screenshot and --window-size.
3. Capture a full page with Playwright
Playwright’s screenshot API supports a full-page option. The following is a complete Node.js example using the Playwright package and its Chromium browser:
npm install playwright
npx playwright install chromium
// screenshot.mjs
import { chromium } from 'playwright';
const url = process.argv[2] ?? 'https://shop.example.in/';
const browser = await chromium.launch({ headless: true });
const page = await browser.newPage({
viewport: { width: 1365, height: 900 },
locale: 'en-IN',
timezoneId: 'Asia/Kolkata',
});
try {
await page.goto(url, { waitUntil: 'networkidle', timeout: 60000 });
await page.screenshot({ path: 'store-page.png', fullPage: true });
} finally {
await browser.close();
}
Run it with node screenshot.mjs 'https://shop.example.in/'. Locale and timezone set browser context values; they do not select a delivery address, currency, or language on every retailer. Handle a store’s own location controls only when appropriate, and record what you selected. If networkidle never occurs because the page keeps making requests, choose a more suitable navigation wait and wait for a specific page element instead. Playwright supports page, element, full-page, and device-pixel screenshot options; see the Playwright screenshot guide.
Capture a specific product or results element
When you need one product card, listing, or other region rather than the whole page, locate the element and capture it directly:
const product = page.locator('[data-testid="product-card"]').first();
await product.screenshot({ path: 'product-card.png' });
Replace the selector with one that exists on the target page. If it matches nothing, inspect the rendered page and use a stable selector. A locator screenshot avoids including unrelated page content in the image.
4. Capture with Puppeteer
Puppeteer provides scripted navigation and a page screenshot API. Install Puppeteer, save this script, and run it with Node.js:
npm install puppeteer
// screenshot-puppeteer.mjs
import puppeteer from 'puppeteer';
const url = process.argv[2] ?? 'https://shop.example.in/';
const browser = await puppeteer.launch({ headless: true });
try {
const page = await browser.newPage();
await page.setViewport({ width: 1365, height: 900 });
await page.goto(url, { waitUntil: 'networkidle2', timeout: 60000 });
await page.screenshot({ path: 'store-page.png', fullPage: true });
} finally {
await browser.close();
}
Run node screenshot-puppeteer.mjs 'https://shop.example.in/'. The wait option controls when navigation is considered ready; it does not guarantee that every recommendation, image, or other dynamic element has appeared. For a page with ongoing network activity, wait for the element you need. The Puppeteer screenshot guide demonstrates navigation followed by a screenshot.
5. Make the capture representative and repeatable
An Indian ecommerce page can vary by the exact URL and the state of the browser session. Before capturing, write down the conditions relevant to your use case:
- URL: Record the full page URL, including meaningful query parameters.
- Viewport: Save the width and height; use the same values for comparisons.
- Language and region: Record the displayed language and any region selection. Browser locale alone may not control a site’s own setting.
- Delivery location: If a postcode or location changes availability or delivery details, record the selected value without assuming every store uses the same process.
- Currency and login state: Note what was visible. Avoid including account or personal information unnecessarily.
- Prompts: Record whether cookie consent, location prompts, or other dialogs were handled.
- Capture time: Keep the time with the image when the page is documentation or evidence.
A screenshot shows what that browser session rendered at that time. It does not establish a universal price, stock status, or experience for all users. If the image will be published or used as evidence, check the specific site’s current terms and the intended use of its page imagery.
6. Wait for the content you need
Pages often continue changing after the initial document loads. Chrome’s CLI offers --timeout, which sets a maximum wait before capture even if the page is still loading. A maximum wait is not confirmation that every image or widget is ready. See Chrome’s Headless CLI reference.
With automation, wait for the state your task actually needs. A page-level navigation wait is a starting point; a product title, price region, or results container can be a better readiness condition for a specific capture. For long listings, scrolling through the page may trigger lazy-loaded content before a full-page screenshot. The exact behavior depends on the site, so inspect the output rather than assuming every lazy image has loaded.
7. Troubleshoot common capture problems
| Symptom | Likely cause | What to try |
|---|---|---|
| No screenshot file appears | Chrome is unavailable under the command name, or the process could not write to the current directory. | Check the installed browser command and its output for errors; run from a writable directory and use a clear output workflow. |
| Image has the wrong layout | The viewport dimensions differ from the intended desktop or mobile view. | Set --window-size in the CLI or the viewport in Playwright/Puppeteer, then record those dimensions. |
| Screenshot is blank or incomplete | Navigation failed, capture happened too early, or the page is still rendering. | Check navigation errors and the destination URL; use a suitable wait or wait for the needed element, then inspect the result. |
| Some listing images are missing | Images may load only when scrolled into view or may still be downloading. | Scroll through the relevant content before capturing and allow the page to settle. Behavior is site-specific. |
| Full-page capture is unexpectedly short | The capture used a viewport screenshot or the page had not expanded its content yet. | Use Playwright’s fullPage: true or Puppeteer’s full-page screenshot option; check the page’s rendered height and readiness. |
| Location, price, or language differs between runs | The site’s regional state, session, or selected delivery location changed. | Repeat with a deliberate session and record the URL, browser state, locale, and store-specific selections. |
| Automation waits indefinitely or reaches a timeout | Persistent requests can prevent a network-idle condition, or the page is slow or unreachable. | Use a finite timeout and wait for the specific content needed instead of relying only on network idle. |
| Element screenshot fails | The selector did not match, or the target is not ready or visible. | Confirm the selector against the rendered page and wait for the target element before capturing. |
8. Performance, reliability, and cost
The CLI is the smallest workflow for an occasional viewport capture. A persistent automation script adds setup but makes repeated captures and page-state handling explicit. Full-page screenshots can take longer and produce larger files than viewport images because they include more rendered content. Set a finite navigation timeout, close the browser in a finally block, and use a deliberate wait condition so a failed page does not leave a job hanging.
Keep capture inputs stable when comparing runs: URL, viewport, browser mode and version, locale, location selection, login state, and capture timing. Browser automation uses local compute and browser resources; managed screenshot APIs instead charge according to their service plans. No benchmark or retailer-specific reliability result is implied here.
Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server from Yorker Media. A single request returns a PNG, JPEG, WebP, or PDF. Its capture flow accepts cookie and consent banners like a visitor and removes 60+ known consent platforms, newsletter popups, and chat widgets before the shot; each of those steps can be turned off. Only clean shots are billed: bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report the page verdict and billing status.
Use this cURL example to save a WebP screenshot of a store page. Replace the sample target with the URL you need:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://shop.example.in/ -o shot.webp
See the ScreenshotNeo API documentation for request options. The same endpoint can be called from Python or Node.js:
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://shop.example.in/"},
timeout=90,
)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({
access_key: 'YOUR_API_KEY',
url: 'https://shop.example.in/'
});
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot request failed: ${res.status}`);
await import('node:fs/promises').then(fs => fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer())));
ScreenshotNeo also offers an MCP server so AI agents using Claude, Cursor, or another MCP client can take screenshots with take_screenshot, inspect pages with get_page_info, and capture PDFs with capture_pdf. One thousand screenshots per month are free with no card; paid plans start at $5 for 3,000 screenshots. Sign up for ScreenshotNeo’s free 1,000 screenshots per month, with no card required.
FAQ
Can Chrome’s Headless CLI capture an entire long page?
For a full scrollable page, use Playwright or Puppeteer with their full-page screenshot option. The Chrome CLI reference cited here documents a viewport screenshot.
Does setting en-IN select an Indian delivery postcode?
No. Browser locale can set browser context, but a retailer may manage delivery location through its own page controls or session state.
Does a screenshot prove an item was available to every customer?
No. It records one rendered session at one point in time. Preserve the relevant location and session context if availability matters.
Which browser mode should I deploy?
Use unified Headless Chrome when regular Chrome rendering is the priority. Consider chrome-headless-shell when its lighter deployment characteristics fit the job, and confirm compatibility with your installed version.


