ScreenshotNeo

BlogHow-to

How to Capture Product Prices on BigBasket with Playwright Screenshots

Learn how Playwright saves page screenshots, what a price screenshot can and cannot prove, and why BigBasket’s terms require written consent for automated price collection.

By the ScreenshotNeo team4 October 20267 min read

Direct answer: Playwright can save a screenshot of a browser page with page.screenshot({ path: 'screenshot.png' }). But do not use that capability to collect or monitor BigBasket product prices unless you have express written consent covering that activity. BigBasket’s published terms restrict automated access and the collection or use of product listings, descriptions, and prices. The code below is for a page or test fixture you are authorized to automate; it is not a BigBasket price-scraping script.

The reviewed sources do not establish whether BigBasket offers a public price API or an authorized export workflow for this task. Ask BigBasket for written authorization and an approved data-access method before building a collection workflow. A screenshot records pixels in one browser context; it does not prove that a price is current, available to other customers, or comparable across locations, accounts, and sessions.

1. Check permission before automating

BigBasket’s general terms say users must not use a page-scrape, robot, spider, or other automatic method to access, acquire, copy, or monitor content through means the platform has not purposely made available. Clause 14.2 also excludes collection and use of product listings, descriptions, or prices from the limited platform-use license without express written consent. Its business-site terms separately restrict collection of listings, descriptions, or prices and data-gathering tools. Read the general terms and, if relevant to your use, the business-site terms; terms can change.

Do not treat a screenshot, a normal browser session, or a low request rate as permission. Do not work around access controls, bot checks, login requirements, or other restrictions. If you receive written authorization, follow its scope and use the access method it approves. This guide does not supply BigBasket selectors, login steps, location setup, or readiness logic because the sources do not establish those details or authorize their use.

2. Install Playwright for an authorized page

The example captures a page you control or are authorized to automate, such as a local test fixture. It uses Playwright’s documented Page screenshot API and does not interact with BigBasket.

mkdir playwright-screenshot
cd playwright-screenshot
npm init -y
npm install playwright
npx playwright install chromium

Save this as capture.js:

const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch();
  try {
    const context = await browser.newContext({ viewport: { width: 1280, height: 900 } });
    const page = await context.newPage();

    // Replace with a page you control or are expressly authorized to automate.
    await page.goto('http://localhost:3000/fixture', {
      waitUntil: 'domcontentloaded',
      timeout: 30_000,
    });

    await page.screenshot({ path: 'screenshot.png', fullPage: true });
    await context.close();
  } finally {
    await browser.close();
  }
})();

Start your authorized fixture at that address, then run node capture.js. The example uses domcontentloaded so it does not wait indefinitely for analytics or other long-lived network connections. If the content you own renders after navigation, add an explicit readiness condition for that fixture, such as waiting for a known selector.

See the official Playwright Page API for the screenshot options and current API details. Its generic example demonstrates launching a browser, opening a page, navigating, and saving a screenshot. It does not document BigBasket-specific selectors, consent handling, or permission.

3. Choose screenshot options deliberately

Option What it changes When to use it
path Writes the image to a file; the extension determines the image type. Use a stable path such as artifacts/page.png for test output.
fullPage: true Captures the full scrollable page rather than only the viewport. Use when the authorized page’s relevant content extends below the fold. Long pages produce larger images.
type: 'png' or type: 'jpeg' Selects the image format when not determined by the path. PNG preserves crisp text; JPEG can reduce file size for photographic content. Use supported formats documented by your installed Playwright version.
quality Sets lossy image quality for JPEG. Only applies to JPEG; choose a value that keeps small text legible.
clip Captures a rectangle of the page. Useful for a specific region in an authorized fixture; coordinates must fit the rendered page.
scale Controls whether output uses CSS pixels or device pixels. Use the documented values for your Playwright version when balancing detail and output size.
timeout Limits how long the screenshot operation may take. Set a bound in CI so a stalled page does not hang the job.
animations, caret, omitBackground, style Controls animation behavior, caret visibility, background transparency, or injected screenshot-only styles. Use these to make authorized visual tests repeatable; consult the API docs for exact supported values and behavior.

For a price record in an authorized system, record context alongside the image: capture timestamp and timezone, the page or fixture version, location and account context if relevant and authorized, product identifier and pack size, and whether the amount is a displayed estimate or final checkout amount. Do not infer context that the screenshot does not show.

4. Interpret price screenshots carefully

BigBasket’s terms say prices at order time apply at delivery, and note that some commodity and fresh-food prices can change daily. Its true-weight policy says the displayed price for fresh fruits and vegetables may be descriptive; the final amount depends on the actual packed weight. A screenshot is therefore a record of what appeared in one session at one time, not a guarantee of the final charge or universal availability. See clauses 5.1–5.2 of the general terms.

Even where you have authorization, avoid comparing two images as if they were directly equivalent unless you can establish that location, account state, product variant, pack size, promotions, and capture time match. Keep the original image and its metadata together if the record needs to be audited.

5. Other request examples for authorized pages

These examples demonstrate a ScreenshotNeo request against https://example.com, not BigBasket. Use ScreenshotNeo only for a URL you are authorized to capture and only where your authorization covers the service involved. See the ScreenshotNeo API documentation for request parameters and response behavior.

cURL

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

Python

import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://example.com"},
    timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)

Node.js

const q = new URLSearchParams({
  access_key: 'YOUR_API_KEY',
  url: 'https://example.com',
});
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot request failed: ${res.status}`);
await Bun.write('shot.webp', res);

In Node.js environments without Bun, write the response bytes using your runtime’s file APIs. Keep the API key out of source control and logs. The examples use the service’s documented API base and supplied request pattern; they do not make an unauthorized target permitted.

6. Troubleshooting authorized Playwright captures

Symptom Likely cause Fix
Browser executable missing The Playwright package is installed, but its browser was not installed. Run npx playwright install chromium in the project environment.
Navigation times out The page is slow, unreachable, or waiting for a load state that never settles. Check the authorized target and network, set a bounded timeout, and choose a readiness condition appropriate to the page. Do not use timeouts as a reason to bypass a site restriction.
Screenshot is blank or incomplete The page may not have rendered its content yet, or the selected capture region may be outside the content. For a page you control, wait for a stable, known element and verify viewport and clip dimensions.
Content is cut off The capture used the viewport rather than the full page. Set fullPage: true when appropriate, or capture a deliberate clip.
Image differs between runs Dynamic content, animation, fonts, time, or viewport differences affect rendering. Use a fixed viewport and controlled fixture data; disable or account for animations in visual tests.
Permission or access warning The site or applicable terms restrict automated access. Stop automation and obtain express written consent or an approved access path. A screenshot does not resolve the restriction.

7. Performance, reliability, and cost

For a page you control, keep the browser lifecycle bounded: reuse a browser process for a batch of authorized test pages where appropriate, close contexts and pages when finished, and set navigation and screenshot timeouts. Full-page images and high device scale factors use more memory and storage than viewport captures. Fix viewport and fixture state to reduce flaky visual output.

Playwright runs a browser you manage, so account for browser installation, execution time, storage, and maintenance in your environment. The research sources provide no BigBasket price-capture performance benchmarks or cost estimates. Do not interpret an image file as a validated price feed.

Or skip the browser setup

For pages you are authorized to capture, ScreenshotNeo provides a one-request screenshot API and an MCP server for AI agents. Its capture flow removes cookie and consent banners, newsletter popups, and chat widgets before the shot. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed; responses identify the page verdict and billing status in headers. AI agents can use its MCP server tools, including take_screenshot, get_page_info, and capture_pdf. One thousand screenshots a month are free with no card; paid plans start at $5 for 3,000.

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

See the API documentation. ScreenshotNeo does not grant permission to automate a site; use it only for authorized URLs. Sign up for 1,000 free screenshots a month, with no card required.

FAQ

Does taking a screenshot make automated BigBasket price collection permitted?

No. The screenshot format does not change the restrictions in BigBasket’s published terms. Obtain express written consent for the proposed collection and follow the approved access method.

Does this guide confirm that BigBasket has a public price API?

No. The reviewed sources do not establish a public API or an authorized export workflow for this task.

Can a screenshot prove the price another customer will pay?

No. It records a particular browser context and time. Prices can change, and fresh produce may be charged by actual packed weight.

Which Playwright call saves the screenshot?

Use await page.screenshot({ path: 'screenshot.png' }) on a page you are authorized to automate.