How to Set Up an AI Agent to Screenshot Indian Ecommerce Pages in Rupees
Build an AI agent that captures Indian ecommerce pages with Playwright, checks whether prices are actually shown in rupees, and saves useful screenshots.
Use a browser automation tool such as Playwright to open the retailer page, set an India-oriented browser locale, wait for the page to render, check the page for an INR price, and then save a screenshot. Setting the locale to en-IN can shape browser language and formatting behavior, but it does not force a retailer to show rupees. Verify the rendered page—and, when possible, the displayed price in the DOM—before treating the capture as a rupee-priced example.
This guide uses Python and Playwright for the browser workflow, then shows cURL, Python, and Node.js calls to ScreenshotNeo for a one-request screenshot alternative. Replace the example URL with a page you are permitted to access. Retailer-specific currency behavior is not assumed here.
1. Install Playwright and prepare the agent
Playwright controls a real browser page and can save viewport, element, and full-page screenshots. Install the Python package and Chromium browser in the environment that will run the agent:
python -m pip install playwright
python -m playwright install chromium
If the agent runs in a container or a managed environment, make sure the browser and its required system dependencies are installed there too. Keep the browser context and page automation in the same process; pass the resulting image path or bytes to the agent’s vision or storage component.
2. Capture the page and verify its displayed currency
The following runnable script creates a browser context with an India-oriented locale and desktop viewport, navigates to a configurable URL, checks visible page text for likely INR markers, and saves a full-page image. The currency check is deliberately a signal rather than a guarantee: sites vary in how they render prices, and a symbol or code elsewhere on the page may not describe every product price.
import os
import re
from playwright.sync_api import sync_playwright, TimeoutError as PlaywrightTimeoutError
URL = os.environ.get("TARGET_URL", "https://example.in/")
OUT = os.environ.get("SCREENSHOT_PATH", "page.png")
# This check finds common visible markers. Validate the matching text and page
# context before concluding that the displayed product price is in INR.
INR_MARKER = re.compile(r"₹|\bINR\b", re.IGNORECASE)
with sync_playwright() as p:
browser = p.chromium.launch(headless=True)
context = browser.new_context(
locale="en-IN",
timezone_id="Asia/Kolkata",
viewport={"width": 1365, "height": 900},
)
page = context.new_page()
try:
response = page.goto(URL, wait_until="domcontentloaded", timeout=45_000)
if response is not None:
print(f"HTTP status: {response.status}")
# DOM content loaded does not mean every price or image has rendered.
# A short, bounded wait gives client-side content time to appear.
page.wait_for_timeout(1500)
visible_text = page.locator("body").inner_text(timeout=10_000)
matches = INR_MARKER.findall(visible_text)
print(f"Visible INR markers found: {len(matches)}")
print(f"Currency marker present: {bool(matches)}")
# Save evidence even if no marker is found; the caller must treat the
# currency check as failed or inconclusive in that case.
page.screenshot(path=OUT, full_page=True, animations="disabled")
print(f"Screenshot saved: {OUT}")
except PlaywrightTimeoutError as exc:
raise SystemExit(f"Navigation or page inspection timed out: {exc}")
finally:
context.close()
browser.close()
Run it with a target and output path:
TARGET_URL="https://example.in/product" SCREENSHOT_PATH="product.png" python capture.py
The script intentionally does not select a retailer’s region, accept consent, sign in, or interact with checkout. Those actions are site-specific. If the page requires a region selector, handle it using a DOM locator or accessibility snapshot after inspecting the page, and only proceed in ways permitted by the retailer.
3. Make currency verification more reliable
A screenshot records what the browser rendered. It does not establish why the retailer chose a currency or prove that all prices on the page use it. Use independent checks and retain the relevant evidence:
- Check the image: inspect the product price in the screenshot. Look for the rupee symbol (
₹) or the codeINRadjacent to the amount. - Check the page text: search visible text for the marker, then inspect the surrounding product and price text. A marker in a footer or unrelated banner is not proof that the product price is in rupees.
- Check the page’s region state: if the site exposes a country or delivery-region selector, record the selected state. Browser locale alone is not that selector.
- Report uncertainty honestly: if the page shows no clear marker, record “currency not confirmed” instead of converting a displayed foreign-currency value and presenting it as a retailer-displayed INR price.
For a page or agent that formats its own amount, locale and currency are separate inputs. JavaScript’s Intl.NumberFormat can produce India-style grouping and currency formatting when given both:
const amount = 1234567.89;
const formatted = new Intl.NumberFormat('en-IN', {
style: 'currency',
currency: 'INR'
}).format(amount);
console.log(formatted);
That formats an amount your own application controls. It does not change a retailer’s server-selected, account-selected, or region-selected prices. See MDN’s documentation for Intl.NumberFormat.
4. Choose the right capture scope
| Capture | Use it for | Playwright example |
|---|---|---|
| Viewport | A quick view of what appears above the fold. | page.screenshot(path="viewport.png") |
| Full page | A long listing or product page, including content below the fold. | page.screenshot(path="full.png", full_page=True) |
| Element | A focused product card, price block, or other known region. | page.locator("[data-testid='price']").screenshot(path="price.png") |
| Image bytes | Passing the capture directly to an image-processing step without writing a file first. | image_bytes = page.screenshot(full_page=True) |
Use the DOM, locators, or an accessibility snapshot to identify and interact with controls. A screenshot is visual evidence, not a dependable map of clickable elements; Playwright makes this distinction in its screenshot documentation.
For a mobile page, choose a mobile device profile or set a phone-sized viewport and device scale factor before navigation. Playwright context emulation also supports locale and timezone settings; see its emulation documentation. Pick the context based on the page you need to document rather than assuming that a mobile view and desktop view show identical prices or content.
5. Add waits and interactions only when needed
domcontentloaded is a useful navigation milestone, but client-rendered product details, images, and prices may appear later. Use a targeted condition when you know what should render, with a timeout and a fallback:
# Prefer a known product-price selector when the site provides one.
price = page.locator("[data-testid='price']")
price.wait_for(state="visible", timeout=10_000)
print(price.inner_text())
# Then capture the page after the expected content is visible.
page.screenshot(path="product.png", full_page=True)
Selectors differ between sites, and many retailers do not expose stable test IDs. Inspect the DOM or accessibility information to choose a suitable locator. Avoid unbounded sleeps: they add latency when the page is fast and still fail to help when it is slow. If a page lazy-loads images as you scroll, a full-page capture may require the browser to trigger those loads; inspect the final image for missing sections.
For screenshots that must include a consent state or region prompt, decide explicitly whether the prompt is part of the evidence. Do not silently dismiss or submit a choice that changes the meaning of the page.
6. Managed browser sessions and desktop capture
For ordinary page navigation, clicking, form filling, and extraction, a browser session controlled through Playwright-compatible CDP/WebSocket access can be sufficient. A full desktop screenshot is a different requirement: it can include native dialogs or prompts outside the web page viewport. AWS documents both browser control and OS-level actions for AgentCore Browser; see its guides for browser sessions and browser tools. That managed setup is optional; a standard Playwright page screenshot is the simpler path for ordinary ecommerce pages.
7. Or skip the browser setup
ScreenshotNeo takes a screenshot with one HTTP request. See the ScreenshotNeo API documentation for request options and response details.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.in/product -o shot.webp
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://example.in/product"},
timeout=90,
)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({
access_key: 'YOUR_API_KEY',
url: 'https://example.in/product'
});
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())));
Cookie banners are accepted like a visitor and more than 60 known consent platforms, newsletter popups, and chat widgets are removed before the shot; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies page verdict and billing status. An 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 screenshots each month with no card; paid plans start at $5 for 3,000. These capabilities simplify capture, but you should still verify that the retailer itself displayed INR.
Sign up for 1,000 free screenshots a month, no card required.
8. Troubleshooting
| Symptom | Likely cause | What to do |
|---|---|---|
| Prices appear in another currency | The retailer’s region, delivery location, account, or page state selected that currency. en-IN only sets browser locale behavior. |
Inspect the site’s region state and visible price. Use an allowed region selector if appropriate, reload, and verify again. Do not label a converted amount as retailer-displayed INR. |
| No rupee marker found | The page may use an image, inaccessible label, different currency notation, or the price may not have rendered yet. | Inspect the screenshot and relevant product DOM separately. Wait for a known price locator if available; otherwise mark currency unconfirmed. |
| Navigation times out | The page is slow, keeps background connections open, or blocks the automation session. | Use a bounded timeout and an appropriate navigation milestone such as domcontentloaded. Check response status and page content; do not assume a timeout means the page never loaded. |
| Screenshot is blank or incomplete | Capture happened before client content rendered, a challenge blocked content, or lazy sections did not load. | Wait for a visible page or price locator, inspect the response and screenshot, and retry only under a bounded policy. Treat a challenge page as a failed capture rather than a product page. |
| Element screenshot says element is not visible | The selector is wrong, matches a hidden duplicate, or the element is outside the expected page state. | Inspect locator count and visibility; choose a more specific locator and wait for it to become visible. |
| Browser executable or dependency error | Playwright’s browser was not installed in the active runtime, or the container lacks system libraries. | Install Chromium with python -m playwright install chromium in the same environment and install the required OS dependencies for that deployment. |
| Full-page image omits lower-page imagery | Images or product tiles load lazily only after scrolling. | Scroll through the relevant content, wait for images to settle, then capture and inspect. Keep the workflow bounded on very long pages. |
9. Performance, reliability, and cost
- Scope affects work: a viewport capture is usually less work than a very long full-page image. Capture only the area required by the task.
- Wait for evidence: a targeted locator is more reliable than an arbitrary long delay when the page exposes a stable price element. Keep navigation and locator timeouts finite.
- Keep retries bounded: retry transient navigation failures only a limited number of times, and distinguish them from bot checks or retailer error pages. Repeatedly loading the same page can add latency and requests without improving evidence.
- Record context: store the URL, capture time, locale, viewport or device profile, response status when available, and currency-check result alongside the image. This makes later review more useful.
- Budget for infrastructure: a DIY Playwright agent uses browser runtime and hosting resources; the research sources do not establish a benchmark or price comparison. ScreenshotNeo’s stated plans are Free: 1,000 shots/month; Starter: $5 for 3,000; Growth: $15 for 15,000; Pro: $39 for 60,000; Scale: $99 for 250,000; Business: $249 for 1,000,000. Yearly billing gives two months free, and every feature is on every plan.
10. FAQ
Does setting en-IN guarantee rupee prices?
No. It sets browser locale behavior. The retailer controls its own currency selection; confirm the visible price.
Should the agent convert a foreign price to INR?
Only if the task explicitly asks for a conversion. Label converted values as calculations, not as prices displayed by the retailer.
Can the agent click controls based only on a screenshot?
Use DOM locators or accessibility information to identify controls. A screenshot is best treated as visual evidence.
When is a full desktop screenshot necessary?
Use it when the evidence must include native dialogs or other desktop UI outside the browser page. Ordinary ecommerce page captures generally need only a page screenshot.


