Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Use Puppeteer’s page.screenshot() after the authorized UPI page has rendered its confirmation state. Navigation finishing does not necessarily mean the payment app has finished displaying its success message, so wait for a success indicator specific to your app before capturing.

Capture the confirmation page with Puppeteer

Install Puppeteer in your project if you have not already, then save this as an ES module file such as capture-upi.mjs. Replace the example URL with a page you are authorized to access. The success selector is illustrative: choose a selector that actually appears on your app’s confirmation page.

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();
try {
  const page = await browser.newPage();
  await page.goto('https://your-authorized-test-page.example', {
    waitUntil: 'networkidle2',
  });

  // Replace this with a success indicator from your application.
  await page.waitForSelector('[data-testid="payment-success"]', {
    timeout: 15000,
  });

  await page.screenshot({ path: 'upi-confirmation.png' });
} finally {
  await browser.close();
}

Puppeteer’s official guide uses Page.screenshot() to save a page image. See the Puppeteer screenshot guide for the documented method and examples.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why wait for a success indicator?

waitUntil: 'networkidle2' is a navigation condition, not proof that the payment succeeded or that the confirmation UI has appeared. A web app may render its receipt after an API response or other client-side work. Waiting for a known success label or receipt element makes the capture depend on the page state you need, rather than on navigation alone. The exact selector depends on the app; no particular UPI provider or page was specified.

#1 Best Overall
Sale
Motorola Moto g - 2026 | Unlocked | Made for US 4/128GB | 50MP Camera | Pantone Slipstream, Cellular_Phone
  • Universal unlocked. Compatible with all major U.S. carriers, including Verizon, AT&T, T-Mobile and other prepaid carriers.
  • Super-bright, super-smooth 6.7" display. See your screen clearly even outdoors in sunlight, and enjoy seamless views with a fast-refreshing 120Hz display.*
  • AI-powered camera system. Take stunning photos in any light with the 50MP camera**, look your best with a 32MP selfie cam*****, and capture extreme close-ups.
  • Superfast 5G performance. Unleash your entertainment at 5G speed*** with the MediaTek Dimensity 6300 chipset and up to 12GB of RAM with RAM Boost****.
  • Long-lasting battery + TurboPower charging. Power through day after day with a 5200mAh battery, then get hours of power in just minutes.****

Set a timeout so the script fails visibly if the expected confirmation never appears. Do not take a screenshot on timeout and treat it as a successful receipt: investigate whether the page failed to load, the selector changed, or the authorized test flow did not reach confirmation.

Choose the part of the page to capture

Capture the visible viewport

The default screenshot captures the current viewport. Use this when the confirmation is fully visible and surrounding page content is appropriate for the intended use:

Rank #2
Sale
Samsung Galaxy A17 5G Smart Phone 128GB US 1 Yr Manufacturer Warranty Black
  • YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
  • LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
  • MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
  • NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
  • BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.
await page.screenshot({ path: 'upi-confirmation.png' });

Capture the full page

Set fullPage: true when the receipt extends below the viewport and you need the whole page:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
await page.screenshot({
  path: 'upi-confirmation-full.png',
  fullPage: true,
});

Capture only the receipt element

If the receipt has a stable, app-specific selector, capture that element rather than unrelated page content. Puppeteer documents element screenshots through ElementHandle.screenshot():

Rank #3
Samsung Galaxy A16 5G 128GB Cell Phone, Unlocked Android Smartphone, Large AMOLED Display, Durable Design, Super Fast Charging, Expandable Storage, US Version, 2025, Blue Black (Renewed)
  • Charger NOT Included, 6.7" Super AMOLED FHD+, 90Hz Refresh Rate, 385 ppi, 800 nits (HBM), 1080x2340px, 5000mAh Battery
  • 128GB, 4GB RAM, microSDXC, Exynos 1330 (5nm), Octa-Core, Mali-G68 MP2 or Mali-G57 MC2 GPU
  • Rear Camera: 50MP, f/1.8 (wide) + 5MP, f/2.2 (ultrawide) + 2MP, f/2.4 (macro), LED flash, panorama, HDR; Front Camera: 13MP, f/2.0, Android 14, up to 6 major Android upgrades, One UI 6.1
  • 3G: HSDPA 850/900/1700(AWS)/1900/2100; 4G LTE: 1/2/3/4/5/7/12/13/14/20/25/26/28/29/30/38/39/40/41/48/66/71, 5G: 2/5/25/41/66/71/77/78 SA/NSA/Sub6/mmWave - Nano-SIM + eSIM
  • US Model – Global Connectivity – Compatible with Most GSM Carriers like T-Mobile, AT&T, MetroPCS, etc. Will Also work with CDMA Carriers Such as Verizon, Straight Talk.
const receipt = await page.waitForSelector('[data-testid="payment-receipt"]', {
  timeout: 15000,
});
if (!receipt) throw new Error('Receipt element was not found');
await receipt.screenshot({ path: 'upi-receipt.png' });

Replace the example selector with one from your own app. An element capture is useful when the page includes navigation, chat controls, or other content that should not be in the image.

Capture a specific region

Use clip when you know the rectangle to capture in page coordinates. Its x, y, width, and height should match the rendered layout; fixed coordinates can become wrong when the viewport or page content changes.

Rank #4
Sale
Samsung Galaxy A17 5G Smart Phone 128GB, US 1 Yr Manufacturer Warranty Blue
  • YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
  • LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
  • MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
  • NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
  • BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.
await page.screenshot({
  path: 'upi-receipt-region.png',
  clip: { x: 40, y: 80, width: 680, height: 520 },
});

Puppeteer documents screenshot options including fullPage, clip, and path in its ScreenshotOptions API reference.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Protect transaction details in the image

A receipt-style confirmation can include a reference number, recipient, source account, amount, and transaction date. NPCI’s BHIM-UPI guidelines depict these fields, though the wording and layout vary by app. Capture only an authorized transaction, and store or share the image only for its intended purpose. If the screenshot is for documentation or testing, use a permitted test flow and avoid exposing real account or transaction details unnecessarily.

Best Value
Tracfone Motorola Moto G 2025, 64GB, Saphire Blue (Locked to
  • Carrier: This phone is locked to Tracfone, which means this device can only be used on the Tracfone wireless network. Tracfone plan required, activating is easy, just 3 steps.
  • DISPLAY: Immersive viewing on a 6.7-inch super-bright 120Hz display with powerful stereo speakers and Bass Boost for cinematic entertainment.
  • CAMERA SYSTEM: Advanced 50MP Quad Pixel camera captures sharp, detailed photos and videos in any lighting condition
  • PERFORMANCE: Lightning-fast 5G connectivity paired with a powerful processor and RAM Boost for smooth multitasking.
  • BATTERY LIFE: Long-lasting 5000mAh battery with TurboPower charging technology delivers hours of power in minutes.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use an image or generate a PDF?

Use page.screenshot() for a raster image of the rendered page. If the required artifact is a PDF, Puppeteer provides the separate page.pdf() method. PDF generation uses print CSS media by default, so its appearance may differ from the screen rendering. Choose the output method based on the format your downstream workflow needs; see the Page.pdf() API reference.

Troubleshooting

  • The image shows a loading state instead of confirmation: Navigation completion can precede client-side rendering. Wait for an app-specific success or receipt element before capturing.
  • waitForSelector times out: Confirm that the authorized flow reached a success page and that the selector matches the current page. The example selector is not universal.
  • The screenshot is cut off: Use fullPage: true for a page that extends below the viewport, or capture the receipt element directly.
  • The image includes unwanted content: Prefer an element screenshot or a carefully sized clip region over a full-page capture.
  • The PDF looks different from the screenshot: PDF generation uses print CSS media by default, while a screenshot captures the rendered page. Use the output type that matches the intended rendering.

Or skip the browser setup

For an authorized, publicly accessible confirmation page, ScreenshotNeo can capture a URL with one GET request. It removes cookie banners, newsletter popups, and chat widgets before the shot; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots, and the free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.

See the ScreenshotNeo documentation for request options. This example saves a WebP image:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://your-authorized-test-page.example -o shot.webp

Learn more at ScreenshotNeo, or sign up free for 1,000 screenshots a month with no card.

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.