How to Use an AI Agent to Screenshot Indian Travel Booking Pages in Rupees
Use Playwright to capture a travel booking result, then verify that the fare and currency are visible in the image.
Use a browser automation agent to open the booking page, reach the fare or itinerary you need, check that the rendered page explicitly shows INR or ₹, and then capture the viewport, fare card, or full page. A screenshot records what the browser displayed; it does not prove that a booking was completed or that a price is still available. This guide uses Playwright’s Python API for the browser work. The research reviewed current Playwright documentation, but did not test a live Indian booking site or establish a currency setting for any named site.
Currency is site-specific. Do not assume rupees from a site’s country, URL, or audience. If the fare and its currency label are not visible in the actual browser session, stop and report that INR display could not be verified rather than presenting an ambiguous screenshot as a rupee price.
1. Set up the browser workflow
Install Playwright for Python and its Chromium browser. Keep the browser session and the booking page under the agent’s control. The example below opens a URL you provide, prints an accessibility snapshot for inspection, and pauses for you or your agent to reach the relevant results state. It does not submit passenger details or purchase a ticket.
python -m pip install playwright
python -m playwright install chromium
Save this as capture_fare.py. Supply the exact official booking or results URL you intend to inspect. For pages that require interaction, use the page’s visible controls and inspect a fresh snapshot after each navigation or state change.
import asyncio
import sys
from pathlib import Path
from playwright.async_api import async_playwright
async def main():
if len(sys.argv) < 2:
raise SystemExit("Usage: python capture_fare.py BOOKING_PAGE_URL")
url = sys.argv[1]
async with async_playwright() as p:
browser = await p.chromium.launch(headless=True)
page = await browser.new_page(viewport={"width": 1440, "height": 1000}, device_scale_factor=1)
response = await page.goto(url, wait_until="domcontentloaded", timeout=60000)
print("HTTP status:", response.status if response else "no main response")
await page.locator("body").wait_for(state="visible", timeout=30000)
await page.wait_for_timeout(1500)
# Read the accessible structure and rendered text before deciding what to capture.
snapshot = await page.locator("body").aria_snapshot()
print(snapshot[:12000])
print("\nVisible page text preview:")
print((await page.locator("body").inner_text())[:6000])
# Deliberately fail closed: capture only if a visible INR marker is present.
text = await page.locator("body").inner_text()
has_inr = "₹" in text or "INR" in text.upper()
if not has_inr:
raise SystemExit("INR/₹ is not visible. Verify the site's currency setting and page state; no screenshot saved.")
output = Path("booking-result.png")
await page.screenshot(path=str(output), full_page=False, animations="disabled")
print("Saved:", output.resolve())
await browser.close()
asyncio.run(main())
Run it with a page URL:
python capture_fare.py 'https://booking.example/search-results'
Replace the example URL with a real page you are authorized to access. The script checks for a visible currency marker but cannot determine whether a particular fare is correctly denominated, current, or associated with the intended itinerary. Inspect the printed text and image before using the capture.
2. Let the agent find and verify the fare
An AI agent should treat page inspection and screenshot capture as separate steps. First use the accessible structure and visible text to identify the page’s controls and results. Navigate only as far as needed. After a search, modal, tab switch, or other page change, inspect the page again: accessibility references describe the current state and may be stale after navigation.
- Open the official booking page in the controlled browser session.
- Inspect the accessibility snapshot and visible text to locate the route, travel date, search control, and results.
- Use the site’s displayed controls to reach the intended itinerary. Do not guess a currency selector based on the site’s region.
- Read the rendered fare and confirm that INR or ₹ is visible next to or clearly associated with it. Also note route, dates, passenger context if relevant, and any fare conditions needed to interpret the result.
- If the currency is absent, unclear, or shown in another currency, stop. Explain that the page did not visibly verify an INR fare; do not relabel or convert the amount and call it the site’s displayed rupee price.
- Choose the capture scope and save the image. Review it at normal size for legibility, context, clipping, overlays, and the fare’s currency label.
Accessibility snapshots help an agent locate and operate controls. A screenshot is the visual record of what a visitor would see. Use both: structured page content for interaction and the image for visual verification.
3. Choose viewport, fare-card, or full-page capture
| Capture | Use it when | Trade-off |
|---|---|---|
| Viewport | You need a focused record of the current visible results. | Below-the-fold content is omitted; scroll to the relevant result before capture. |
| One element | You need to isolate a fare card or itinerary. | Surrounding route, date, or page context may be lost. Include enough context to interpret the fare. |
| Full page | You need results or explanatory content below the fold. | The image may be tall and text may be small when viewed as a whole. Full-page mode cannot be combined with element targeting. |
For a fare card, inspect the page to identify a stable CSS selector, then capture its locator. The selector below is a placeholder: replace it with one observed on the actual page. Verify the locator matches the intended card before saving.
fare = page.locator("REPLACE_WITH_OBSERVED_FARE_CARD_SELECTOR").first
await fare.wait_for(state="visible", timeout=15000)
print((await fare.inner_text())[:3000])
await fare.screenshot(path="fare-card.png", type="png", animations="disabled")
For a full-page record, change the capture call to await page.screenshot(path="booking-full.png", full_page=True, animations="disabled"). Playwright supports PNG, JPEG, and WebP. Its scale can be CSS pixels or device pixels; device-pixel scale can produce more detail, but increases image dimensions and file size. For example, use scale="css" or scale="device" with the screenshot call. Check the installed Playwright API documentation for the options available in your version.
4. Review and preserve useful context
Before sharing or archiving, open the saved image and check that:
- The fare amount and INR or ₹ label are readable and visibly associated.
- The route and travel date are present, either in the capture or in accompanying metadata.
- The selected itinerary is the one the agent intended to inspect.
- No banner, dialog, sticky header, or browser overlay obscures the relevant details.
- The image has not clipped the fare card or the context needed to understand it.
Prices and availability can change. A screenshot records one browser state at one point in time; retain capture time and source page alongside it if that context matters. Avoid including personal, payment, or booking reference details in images intended for broader sharing.
5. cURL, Python, and Node.js API alternatives
For direct browser automation, use Playwright when the task needs interaction with page controls or inspection of accessible structure. A screenshot API can capture a URL without managing a local browser. It cannot by itself establish that a site’s displayed fare is in INR: inspect the resulting image and treat currency verification as a page-specific check. See the ScreenshotNeo API documentation for request options.
cURL
curl -G "https://api.screenshotneo.com/v1/shot" \
-d access_key=YOUR_API_KEY \
--data-urlencode url='https://booking.example/search-results' \
-o booking-result.webp
Python
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://booking.example/search-results"},
timeout=90,
)
r.raise_for_status()
with open("booking-result.webp", "wb") as f:
f.write(r.content)
Node.js
const q = new URLSearchParams({
access_key: 'YOUR_API_KEY',
url: 'https://booking.example/search-results'
});
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot request failed: ${res.status}`);
const bytes = new Uint8Array(await res.arrayBuffer());
await import('node:fs/promises').then(fs => fs.writeFile('booking-result.webp', bytes));
Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server. One GET request captures a page as PNG, JPEG, WebP, or PDF. For a booking results URL, use the call below and inspect the returned image for the actual fare and currency label. ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture. Bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents use take_screenshot, get_page_info, and capture_pdf. The free plan includes 1,000 screenshots a month 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://booking.example/search-results' \
-o booking-result.webp
Only clean shots are billed, and each response includes X-Page-Verdict and X-Billed headers. The API also supports full-page and element captures, device presets, custom waits, and caching among its options; use the documentation to select settings for your page. Create a free account at ScreenshotNeo signup.
Troubleshooting
| Symptom | Likely cause | What to do |
|---|---|---|
| No INR marker found | The page displays another currency, has not reached results, or the currency label is rendered outside the inspected text. | Inspect the visible page and image. Use the site’s actual controls if available. Stop if INR or ₹ cannot be visibly confirmed. |
| Snapshot does not match the current page | The page navigated or changed after the snapshot was taken. | Take a fresh accessibility snapshot after each state change and locate controls again. |
| Fare selector times out | The example selector is a placeholder, the card has not loaded, or the page structure differs. | Inspect accessible structure and rendered content, wait for the real card, and replace the selector with one observed on that page. |
| Screenshot is blank or incomplete | Capture happened before content rendered, navigation failed, or the page needs additional loading time. | Check the navigation response and visible page text, wait for a meaningful page element, then capture again. Do not treat a blank capture as a valid result. |
| Text is too small in full-page image | The long page has been scaled down for viewing. | Capture the viewport or fare element, or split the page into focused captures while preserving itinerary context. |
| Browser installation or launch error | Playwright’s browser binary is not installed or the environment lacks required dependencies. | Run the Playwright Chromium installation command for the active Python environment and follow the official Playwright installation guidance for that operating system. |
| API request returns an error | Missing or invalid access key, unreachable target, or invalid request configuration. | Check the key, URL encoding, status code, and ScreenshotNeo response headers; consult the API docs for supported parameters. |
Performance, reliability, and cost
For local Playwright, browser startup and page loading usually dominate the work. Reuse a browser process for multiple captures when appropriate, set explicit navigation and element timeouts, and wait for the specific result rather than relying on a long arbitrary sleep. Some booking pages load content dynamically, so a successful initial navigation does not guarantee that fares are ready. Check the rendered page before capture and fail closed when currency is ambiguous.
Viewport and element images are smaller and easier to inspect than very long full-page captures. Device-pixel scale improves detail at the cost of larger files. For repeatable records, keep the viewport, browser context, URL, date, and capture settings consistent. Booking sites can change layout or page state; selectors may need updating, and availability can change after capture.
Playwright’s software is used to automate the browser; local capture does not incur a ScreenshotNeo per-shot charge. For API capture, ScreenshotNeo’s free plan is 1,000 shots/month with no card. Paid plans are Starter $5 for 3,000, Growth $15 for 15,000, Pro $39 for 60,000, Scale $99 for 250,000, and Business $249 for 1,000,000; yearly billing gives two months free. Every feature is on every plan. Clean shots alone are billed; bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing. Review the returned billing headers to see the disposition of a request.
FAQ
Does a screenshot prove the fare is available?
No. It records what the browser displayed at capture time. Confirm current price and availability with the booking site before making a decision.
Can the agent convert a displayed foreign-currency fare into rupees?
This workflow captures and verifies the site’s displayed currency. A converted estimate is a separate calculation and must be labeled as such; it is not the site’s displayed INR price.
Should I use a screenshot or page text to find the fare?
Use accessible structure and rendered text to locate and inspect the result, then use the screenshot to check visual legibility and context.
Can I capture a completed booking?
Only if that is the page state you need and you can safely handle its personal information. Avoid exposing passenger, payment, or booking reference details in shared images.


