ScreenshotNeo

BlogHow-to

How to Monitor a Hindi Government Portal for Visual Changes with Screenshots

Build a repeatable screenshot monitoring workflow for a Hindi government portal, review visual diffs, and pair them with text and language checks.

By the ScreenshotNeo team4 October 20269 min read

To monitor a Hindi government portal for visual changes, capture the same page in the same browser environment on a schedule, compare each new screenshot with a reviewed reference image, and inspect every difference before accepting a new reference. Treat the image comparison as evidence of visual change—not proof that the page is correct or that its meaning changed. Pair it with text checks and, where feasible, checks of language metadata.

This guide uses Playwright Test for a self-managed workflow. The particular portal is unspecified, so first confirm that automated access is allowed and determine whether the page requires login, a consent choice, or another interaction. Do not assume that a portal is public or safe to automate.

1. Decide what to monitor

Write down the exact URL and state you intend to capture. A portal homepage, a notice detail page, and a search-results page are separate monitoring targets. For each target, record:

  • The URL, including relevant query parameters.
  • The viewport width and height, device scale factor, browser, and operating system.
  • Any interaction needed to reach the page state, such as selecting a language or opening a notice.
  • The expected update frequency and who reviews a detected difference.
  • Whether the page has dynamic regions, such as rotating banners, clocks, counters, or current-date labels.

For Hindi pages, include a viewport and browser that reflect the way readers use the portal. Review the actual glyphs and line wrapping in the rendered screenshot. Do not infer a portal’s font behavior or language controls without checking that site.

2. Set up Playwright Test

Use a consistent environment for both reference creation and recurring runs. Playwright documents that operating system, browser version, settings, hardware, power source, and headless mode can affect screenshots. Its visual comparison guide recommends generating and comparing baselines in the same environment. See Playwright visual comparisons.

mkdir portal-monitor
cd portal-monitor
npm init -y
npm install --save-dev @playwright/test
npx playwright install chromium

Create playwright.config.ts:

import { defineConfig } from '@playwright/test';

export default defineConfig({
  testDir: './tests',
  // Keep reference generation and scheduled runs on the same CI image.
  projects: [
    {
      name: 'chromium-stable',
      use: {
        browserName: 'chromium',
        viewport: { width: 1365, height: 900 },
        deviceScaleFactor: 1,
        locale: 'hi-IN',
        timezoneId: 'Asia/Kolkata',
        colorScheme: 'light',
        reducedMotion: 'reduce',
      },
    },
  ],
  expect: {
    toHaveScreenshot: {
      // Tune only after inspecting real diffs. This is not a substitute for review.
      maxDiffPixelRatio: 0.01,
      animations: 'disabled',
    },
  },
});

Set locale and timezone deliberately; they may change displayed dates, number formats, or content. They do not prove that the document is correctly marked as Hindi. Use the locale appropriate for the page and keep it fixed. Avoid changing browser settings between baseline and monitoring runs.

3. Capture and compare a reference screenshot

Create tests/portal.spec.ts. Replace the example URL with the portal page you are authorized to monitor.

import { test, expect } from '@playwright/test';

const targetUrl = 'https://example.gov.in/';

test('Hindi portal page matches its reviewed visual baseline', async ({ page }) => {
  await page.goto(targetUrl, { waitUntil: 'domcontentloaded', timeout: 60_000 });

  // Wait for a meaningful stable element when the site provides one.
  // Replace this selector with an element actually present on the target page.
  await page.locator('body').waitFor({ state: 'visible', timeout: 30_000 });
  await page.evaluate(() => document.fonts.ready);

  // If the page has lazy images, scroll through it before capturing.
  await page.evaluate(async () => {
    const step = Math.max(window.innerHeight, 600);
    for (let y = 0; y < document.body.scrollHeight; y += step) {
      window.scrollTo(0, y);
      await new Promise(resolve => setTimeout(resolve, 150));
    }
    window.scrollTo(0, 0);
  });

  await expect(page).toHaveScreenshot('hindi-portal.png', {
    fullPage: true,
    animations: 'disabled',
    timeout: 30_000,
  });
});

Run the test once to create the reference screenshot, then review and commit the generated reference file:

npx playwright test

On later runs, Playwright compares the new capture to that reference. A mismatch fails the assertion and produces comparison artifacts for inspection. Do not automatically update the baseline just because the test failed: first decide whether the difference is an intended portal update, incidental rendering noise, or a capture failure.

4. Run it on a schedule and keep an audit trail

Run the capture at a cadence that fits the page’s expected update frequency and the cost of reviewing alerts. Store the run time, URL, browser and operating-system version, screenshot, diff, and reviewer decision alongside the result. This audit trail is an operational recommendation: it helps explain later whether a difference reflects page content or a changed capture environment.

Keep the reference image under version control or in another controlled artifact store. Restrict access if screenshots may contain personal or nonpublic information. Do not store credentials in the test file; use the CI platform’s secret store if authentication is permitted and required.

For example, a CI job can run npx playwright test on a pinned operating-system image and retain the Playwright test results and screenshot artifacts when a run fails. Keep the CI image and browser version stable, and update them as a deliberate maintenance change with a reviewed new baseline.

5. Reduce noise without hiding meaningful changes

Some pages contain expected motion or values that change on every visit. Playwright supports disabling animations, masking selected elements, applying a screenshot stylesheet, and allowing a configured number or ratio of different pixels. These settings can make comparisons useful, but each exclusion can also conceal a real update.

  • Animations: Disable them for the capture when motion is not what you monitor.
  • Masking: Mask only a known volatile element, and verify that it cannot contain a meaningful notice or status.
  • Stylesheet: Use stylePath to suppress known unstable elements if appropriate. Keep the stylesheet with the test and review its effect.
  • Pixel tolerance: Use maxDiffPixels or maxDiffPixelRatio sparingly. A larger tolerance can let small but meaningful changes pass.
  • Stable capture: Wait for a known heading or content container, and wait for fonts when text rendering matters. Avoid relying on a fixed delay alone if a more reliable page condition exists.

Playwright can also wait for two consecutive screenshots to match before saving a screenshot. This can help with pages that settle after initial load, but it does not identify which changing content is unimportant. Consult the Page assertion options and choose settings based on reviewed diffs.

6. Check Hindi text and language separately

A screenshot diff detects pixel changes. It cannot establish that text is accurate, accessible, or correctly tagged. If the words themselves matter, add a text assertion for a stable, important element, or store and compare a text snapshot separately.

test('important Hindi notice text is present', async ({ page }) => {
  await page.goto('https://example.gov.in/', { waitUntil: 'domcontentloaded' });
  const notice = page.locator('main'); // Replace with the actual content selector.
  await expect(notice).toContainText('यहाँ अपेक्षित हिंदी पाठ');
});

Use exact text only when the wording is expected to remain stable; otherwise assert a smaller invariant, such as the presence of a heading or notice identifier. The Government of India’s Guidelines for Indian Government Websites (GIGW) says language changes in document text or text equivalents should be identified with the lang attribute and recommends conveying information as text rather than images of text where the technology can do so. Where you can inspect the document, check language metadata as a separate check:

const languageInfo = await page.locator('html').getAttribute('lang');
console.log('document language:', languageInfo);

Do not treat a screenshot as an accessibility audit. Visual review, text assertions, and language metadata checks answer different questions.

7. Troubleshooting

Symptom Likely cause What to do
Many pixels differ on every run Browser, operating system, fonts, viewport, scale factor, or rendering mode changed; the page may also contain dynamic content. Restore the same environment and settings. Inspect the diff, then mask or suppress only confirmed volatile areas.
The page is blank or incomplete in the screenshot Navigation or an application request did not finish, an interaction is required, or the site returned an error. Inspect the page title, URL, visible text, and failed requests. Wait for a real content selector and handle the required state only if access is authorized.
Hindi glyphs or line breaks differ A different browser or font environment, font loading timing, viewport, or page update may affect rendering. Keep the runtime consistent, wait for document.fonts.ready, and inspect the underlying text as well as the image. Do not assume a particular font is used by the portal.
Test times out The page is slow, a selected element never appears, or a network-idle condition never occurs because the page keeps making requests. Use a realistic timeout, wait for a stable content selector, and inspect trace or network artifacts. Avoid waiting for network idle if the site continuously polls.
Baseline changes unexpectedly A baseline update command may have replaced the reference without review, or a browser update changed rendering. Review the old and new screenshots and diff, identify the environment change, and accept the new reference only after confirming the portal change is intended.
Small changes never fail the assertion The pixel tolerance is too high, or important content is inside a masked or hidden region. Lower the tolerance and re-check masks and screenshot styles. Add a text assertion for the content that matters.
Repeated alerts for a rotating banner The banner changes between runs or its timing is nondeterministic. Decide whether the banner is in scope. If not, suppress only its confirmed region; if it is in scope, stabilize the capture state or review those changes separately.

8. Reliability, performance, and operating cost

A screenshot run consumes browser and CI time and can fail because of network or portal availability. Use a bounded navigation timeout, save diagnostic artifacts on failure, and distinguish a capture failure from a genuine visual difference. Retry transient failures carefully; if every retry is treated as a changed page, operators can receive misleading alerts.

Full-page screenshots can take longer and produce larger artifacts than a viewport capture. Capture only the region that answers the monitoring question when possible. If you monitor several pages, run them with a concurrency limit that your CI environment and the site can support. Avoid unnecessarily frequent requests, and follow the portal’s terms and access guidance.

The ongoing cost depends on your browser runtime, CI or hosting arrangement, artifact retention, and review process. The research sources do not establish a price for this workflow or a current price for hosted alternatives. Keep the environment stable: unplanned browser upgrades can create broad diff noise and review work.

9. Alternative monitoring approaches

Playwright Test suits developers who want browser-state control, code-managed baselines, and the ability to combine visual and text assertions. The changedetection.io project README describes visual region selection, change inspection, and interactive browser steps; it also says its Playwright content fetcher is included as part of a subscription service. Check its current packaging and terms directly before choosing it. See the changedetection.io project.

For any approach, first verify that it can reach the required page state, capture at the viewport you need, preserve reviewable diffs, and avoid alerting on known volatile content. Neither screenshots nor automated text checks determine whether a government notice is legally or factually correct.

Or skip the browser setup

With ScreenshotNeo, a GET request can return a screenshot of a URL. See the API documentation for the request options.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.gov.in/ -o portal.webp
import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://example.gov.in/"},
    timeout=90,
)
open("portal.webp", "wb").write(r.content)
const q = new URLSearchParams({
  access_key: 'YOUR_API_KEY',
  url: 'https://example.gov.in/',
});
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('portal.webp', await res.arrayBuffer());

ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers report the page verdict and billing status. 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 screenshots.

Sign up for 1,000 free screenshots a month, with no card required.

FAQ

Does a visual diff prove that the portal changed its content?

No. It shows that rendered pixels differ. A text assertion can help establish whether specific wording changed.

Should I automatically accept a new screenshot baseline?

No. Review the difference and confirm it reflects an intended change before replacing the reference.

Can screenshot monitoring verify GIGW or WCAG conformance?

No. Screenshots can support visual review, but conformance needs broader checks, including text, semantics, and language metadata where relevant.

What if the portal requires login or blocks automation?

Check its terms and access requirements, and do not try to bypass access controls. If authorized access is available, handle credentials through a secure secret store and keep them out of screenshots and logs.