ScreenshotNeo

BlogHow-to

Capture a Screenshot of an Indian Bank Net Banking Page with Puppeteer

Capture an authorized bank page with Puppeteer. Learn viewport, full-page and element screenshots, safe handling, troubleshooting, and a no-code-browser API option.

By the ScreenshotNeo team4 October 20267 min read

You can capture a page you are authorized to view with Puppeteer’s Page.screenshot() API. Navigate to the permitted page, choose a viewport and readiness condition, then save a PNG. The example below uses example.com as a placeholder: it does not log in to a bank or demonstrate automation of an authenticated banking service. Puppeteer’s screenshot documentation explains the capture API, but does not establish permission to automate any Indian bank’s website. Check the selected bank’s terms and use only a bank-provided test environment or a page you are allowed to capture. [Puppeteer screenshots guide] [Page.screenshot() API]

Set up Puppeteer

Use a current Node.js installation, then create a project and install Puppeteer. The regular puppeteer package downloads a compatible browser during installation. Use puppeteer-core when you manage the browser separately and provide its executable path yourself. If your package manager blocks install scripts, the browser may not be downloaded and launch can fail. [Puppeteer installation guide]

mkdir bank-page-capture
cd bank-page-capture
npm init -y
npm install puppeteer

Save the following as capture.mjs. It captures a page that is publicly accessible or otherwise explicitly permitted for your use.

Capture a permitted page as PNG

import puppeteer from 'puppeteer';

const targetUrl = 'https://example.com/'; // Replace only with an authorized page.
const browser = await puppeteer.launch();

try {
  const page = await browser.newPage();
  await page.setViewport({ width: 1365, height: 900 });
  await page.goto(targetUrl, { waitUntil: 'networkidle2', timeout: 30000 });
  await page.screenshot({ path: 'bank-page.png', fullPage: true, type: 'png' });
  console.log('Saved bank-page.png');
} finally {
  await browser.close();
}

Run it with node capture.mjs. The finally block closes Chrome even when navigation or capture throws. The page is not authenticated by this example; do not add credentials, PINs, OTPs, or session tokens to source code or logs.

Choose what to capture

Need Setting or method What it does
Visible browser window puppeteer.launch({ headless: false }) Runs visible Chrome. Puppeteer is headless by default. The guide notes that chrome-headless-shell can behave differently from regular Chrome.
Current viewport only fullPage: false Captures the current viewport; this is the default.
Entire document fullPage: true Captures the full page, including content below the initial viewport when supported by the rendered page.
One specific region page.locator('selector').screenshot({ path: 'region.png' }) Captures a selected element. Puppeteer attempts to scroll an element into view if it is hidden.
Different file location path: 'captures/page.png' Writes the image to that path; ensure the directory exists.
JPEG or WebP type: 'jpeg' or type: 'webp' Selects another documented screenshot format; PNG is the default.

These options and element capture behavior are documented in the Puppeteer screenshots guide. For a real bank page, capture only a state reached through the account holder’s normal, authorized use. If automation is blocked or a security challenge appears, stop and use a bank-approved method.

Viewport versus full-page capture

A viewport image records the visible browser area at the chosen width and height. It is useful when the desired evidence is a particular screen. A full-page image can include additional content below the fold, but may be very tall. Pages that load content as the user scrolls can render differently from a static document, so inspect the result and use a permitted page-specific readiness condition where needed.

Capture one element

const accountSummary = page.locator('.account-summary');
await accountSummary.screenshot({ path: 'summary.png' });

Replace the selector with one that belongs to the page you are permitted to capture. Element capture is useful for a non-sensitive test fixture or a deliberately redacted region. Do not assume that selecting a smaller area makes sensitive account data safe to publish.

Wait for the page to be ready

The sample waits for networkidle2, matching the official guide’s example. It means the network has become relatively quiet; it does not guarantee that every bank page has finished rendering. Some sites keep requests open, render important content later, or require an interaction.

For an authorized test page with a stable marker, wait for that marker explicitly:

await page.goto(targetUrl, { waitUntil: 'domcontentloaded', timeout: 30000 });
await page.waitForSelector('[data-test="ready"]', { timeout: 10000 });
await page.screenshot({ path: 'ready-page.png', fullPage: true });

Use selectors and wait conditions appropriate to the page and permitted workflow. A fixed delay can be used when a test fixture has a known animation or render delay, but it is less reliable than waiting for a meaningful condition. Never wait for, solve, or work around a bank’s CAPTCHA or other access control.

Handle authenticated banking screens safely

An authenticated banking screenshot may reveal names, account identifiers, balances, or transactions. The RBI-hosted security annex advises customers to protect their computers and avoid financial transactions on public or internet-café computers. RBI consumer-awareness material also warns that screen-sharing or remote-access apps can expose financial credentials. These are security cautions, not Puppeteer-specific rules or proof that a bank permits automation. [RBI Internet Banking – Security Features (Annex-II)] [RBI consumer awareness material]

  • Confirm that the bank’s terms and the specific use case allow the capture.
  • Prefer a bank-provided demo or test environment. For a real account, favor an account-holder-operated capture after normal login, where permitted.
  • Do not place usernames, passwords, PINs, OTPs, or session tokens in code, command history, logs, screenshots, or public repositories.
  • Keep original files in access-controlled storage. Redact identifying and financial details before sharing; check the exported image itself for hidden or overlooked sensitive data.
  • If the bank blocks automation or presents a security challenge, stop. Do not bypass authentication, MFA, CAPTCHA, or other controls.

Common errors and fixes

Error or symptom Likely cause Fix
Browser executable not found Install scripts were blocked, or puppeteer-core is being used without a managed browser path. Allow the normal Puppeteer browser installation, or configure the installed browser executable when using puppeteer-core. See the installation guide.
Navigation timeout The page did not reach the selected readiness condition before the timeout; some sites keep network connections open. Use an appropriate condition such as domcontentloaded, adjust the timeout for a permitted test page, then wait for a meaningful page-specific selector. Do not disable a bank control to make navigation succeed.
Screenshot file is missing The output directory does not exist, the process lacks write access, or capture failed before writing. Use a valid writable path, create the directory first, and inspect the thrown error. Puppeteer’s path option controls file output.
Page is blank or incomplete Capture ran before the page rendered, required content is lazy-loaded, or navigation did not reach the intended page. Check navigation outcome and wait for an authorized page-specific ready marker. Review the page manually; do not automate a bank login or evade a challenge.
Element capture fails or is clipped The selector matched no element, matched an unexpected element, or the layout changed before capture. Wait for the intended selector, verify it matches the expected element, and use the element screenshot API. Puppeteer can scroll a hidden element into view.
Visible and headless captures differ They use different browser execution modes or page conditions. Compare with headless: false on an authorized test page. Puppeteer documents different behavior for Chrome Headless Shell; do not assume either mode is universally more reliable for bank pages.

Performance, reliability, and cost

A local Puppeteer capture uses your machine or server to run a browser. The main practical costs are browser startup, page loading, and image size; full-page captures can produce large files. Reuse a browser process for multiple permitted captures when building a batch workflow, while isolating page contexts and reliably closing pages and the browser. Set navigation and wait timeouts, record failures without logging secrets, and validate outputs before treating them as evidence.

Network-idle is only one readiness signal, and neither headless nor visible mode guarantees that a particular banking page will render identically every time. Test with an approved environment and retain a clear failure path. No universal bank automation permission or reliability guarantee is established here. Puppeteer itself is open-source software; infrastructure, browser hosting, and operational costs depend on where you run it.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. For a page you are authorized to capture, one GET request returns an image or PDF. It removes cookie banners, newsletter popups, and chat widgets before capture; those cleanup steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report the page verdict and billing status. Its MCP server offers screenshot and PDF tools for AI clients. Do not use a screenshot service to bypass a bank’s access controls or capture a page without permission.

See the ScreenshotNeo API documentation before using the endpoint. Example request:

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

Replace the placeholder URL only with a page you are allowed to capture. ScreenshotNeo includes 1,000 screenshots per month free with no card; paid plans start at $5 for 3,000 screenshots. Create a free ScreenshotNeo account.

FAQ

How do I take a full-page screenshot with Puppeteer?

Call page.screenshot({ path: 'page.png', fullPage: true }) after navigating to a page you may capture and waiting for the relevant content.

How do I save a Puppeteer screenshot as a PNG?

Use a path ending in .png, or specify type: 'png'. PNG is Puppeteer’s documented default image type.

Does this example sign in to an Indian bank?

No. It demonstrates the screenshot API on a placeholder public page. The example does not establish permission to automate an authenticated bank service.

Can I publish a screenshot of my account?

Only after checking the bank’s terms and removing sensitive information. Treat the original screenshot as confidential financial data.

References: Puppeteer screenshots, Page.screenshot() API, Puppeteer installation, Headless modes, RBI Internet Banking security annex, and RBI consumer awareness.