DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
FREEDOM251

Freedom251 › Blog › browser automation

How to Take a Playwright Screenshot of an Indian Railway Booking Page

By Freedom251 Team · · 5 min read

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

Use Playwright’s page.screenshot() to save the page state your browser is permitted to access. For the visible viewport, call it after navigation; add fullPage: true to capture the full scrollable page, or use a locator to capture one element. The example below shows the API call, but does not guarantee that IRCTC’s live site will allow automated navigation or expose a booking form without an authorized session.

Capture a page with Playwright

Install Playwright in a Node.js project and install its Chromium browser. For example, run npm init -y, npm install playwright, and npx playwright install chromium. Save this as capture.mjs and run it with node capture.mjs:

As an Amazon Associate I earn from qualifying purchases.

import { chromium } from 'playwright';

const browser = await chromium.launch();
try {
  const page = await browser.newPage();
  await page.goto('https://www.irctc.co.in/');
  await page.screenshot({ path: 'railway-booking-page.png' });
} finally {
  await browser.close();
}

This saves the current viewport to a PNG file. The official Playwright Screenshots guide documents page and element captures. The example does not establish that the current IRCTC production page is reachable in automation, that a booking form will appear immediately, or that you can enter a login or booking state automatically.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

Choose what to capture

Capture Playwright call What it includes Useful for
Viewport page.screenshot({ path: 'page.png' }) The currently visible browser viewport Showing what a user sees without scrolling
Full page page.screenshot({ path: 'page-full.png', fullPage: true }) The full scrollable page as a tall image Documenting content below the fold
One element page.locator(selector).screenshot({ path: 'section.png' }) The selected element Isolating a public timetable or result card

Full-page capture

Replace the screenshot call with:

await page.screenshot({ path: 'railway-booking-page-full.png', fullPage: true });

Playwright captures the full scrollable page, rather than only the current viewport. Long pages can produce very tall images; use viewport capture if the intended artifact is a single screen.

#1 Best Overall
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB | 1920×1080 LED Monitor, 4ms GtG, Adaptive Sync, HDMI 1.4, Tilt Adjust, Low Blue Light, 4yr Advance Replacement Warranty
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

Capture a specific section

Use a CSS selector for an element that exists on the page under test:

await page.locator('YOUR_SELECTOR').screenshot({ path: 'booking-section.png' });

YOUR_SELECTOR is deliberately illustrative: no current IRCTC selector was verified. Inspect the page you are authorized to access and choose a selector that matches the element you need.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB | 1920×1080 LED Monitor, 4ms GtG, Adaptive Sync, HDMI 1.4, Tilt Adjust, Low Blue Light, 4yr Advance Replacement Warranty
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors

Handle page readiness and sensitive data

The minimal example takes a screenshot after page.goto() completes its default navigation wait. If the content you need appears later, wait for a relevant selector that you have verified on the page, or use an explicit delay where appropriate. Do not assume that a particular booking form, result, or login control has a fixed selector or timing on the current site.

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

Use only an authorized session and page state. Do not publish screenshots containing real passenger information, OTPs, payment details, or booking references. Playwright does not bypass authentication, bot checks, or site restrictions.

Rank #3
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

Make visual checks more repeatable

For automated visual testing, Playwright Test’s toHaveScreenshot() assertion waits for two consecutive screenshots to match before comparing with the expected snapshot. The PageAssertions documentation also describes controls such as animation handling, masking dynamic regions, and CSS-pixel versus device-pixel scale.

These controls help manage visual noise; they cannot make a changing live railway page deterministic. Prefer a controlled test page or stable fixture when a test needs predictable output. Mask genuinely variable areas, and use consistent viewport and scale settings between baseline and later runs.

Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor | 100Hz, Game Mode, Advanced Eye Comfort, HDMI and D-sub Ports (LS27D366GANXZA)
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

IRCTC-specific limits to keep in mind

The IRCTC International User Guide is a guide with registration and email-verification examples, not proof of the current layout or automation requirements of every production booking page. It warns: “This is testing website. PNR booked using this website is not authorized for journey.” That warning concerns the testing website described in the guide; do not treat the document as confirmation of present-day production behavior.

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

No current production login flow or automation terms are established here. Whether unattended navigation works, or which page states are available, depends on the live service and your authorization.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common capture problems

  • Chromium fails to launch: install the browser binary with npx playwright install chromium. If installation is blocked by your environment, use a browser and setup permitted by that environment.
  • The screenshot is blank or missing the expected content: confirm that navigation completed and wait for a verified page element before capturing. A successful screenshot call does not prove that the intended booking content loaded.
  • A locator screenshot fails: check that the selector matches an element in the page state you reached. Do not copy an assumed selector from an unrelated or outdated layout.
  • The live site blocks or redirects automation: do not try to evade the restriction. Use an authorized session or choose a page you are permitted to capture.
  • The image changes between runs: live content, animations, and dynamic regions can vary. Use Playwright Test’s screenshot assertion controls or capture a stable test page.

Or skip the browser setup

If you need a screenshot through an API instead of maintaining a local browser, ScreenshotNeo takes a screenshot with one GET request. It is not a way around IRCTC authentication, bot checks, or access restrictions; use it only for a URL and page state you are authorized to capture.

For the exact options and response details, see the ScreenshotNeo documentation. Example using cURL:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://www.irctc.co.in/ -o shot.webp

ScreenshotNeo accepts and removes cookie or consent banners before capture, along with known newsletter popups and chat widgets; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server gives AI agents screenshot, page-info, and PDF-capture tools. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.

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

Sign up for ScreenshotNeo’s free plan: 1,000 screenshots a month, no card required.

Frequently Asked Questions

Can Playwright capture a logged-in booking page?

Only when you access that page through a session you are authorized to use. The example does not automate login or bypass access controls.

Does the IRCTC guide confirm what the live booking site looks like today?

No. The linked International User Guide contains dated examples and does not establish the current production layout or automation behavior.

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.

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

browser automationIRCTCPlaywrightscreenshotsWeb development

Leave a Reply

Your email address will not be published. Required fields are marked *

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

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.