ScreenshotNeo

BlogHow-to

How to Take Selenium Screenshots of Indian NGO Websites for Accessibility Audits

Capture repeatable Selenium screenshots for Indian NGO accessibility audits, document each page state, and use the images as evidence—not proof of WCAG conformance.

By the ScreenshotNeo team4 October 202610 min read

Selenium WebDriver can open an NGO webpage and save the current browser window as a PNG with driver.save_screenshot(). For a useful accessibility audit, capture each planned page at a documented viewport and interaction state, then assess the page against the relevant accessibility criteria separately. A screenshot records what appeared in one browser session; it cannot prove accessibility or WCAG conformance on its own.

This guide shows a repeatable Python workflow, options for page and element captures, ways to record audit evidence, India-specific scope considerations, and common fixes. It does not assess any particular NGO website.

1. Plan the audit evidence

Decide which pages and user tasks need visual evidence before automating capture. A homepage image alone will not document a donation form error, an open navigation menu, or another interaction state.

  1. Choose the scope. List URLs, important page types, and states to inspect, such as the default page, expanded menu, form validation error, or confirmation state.
  2. Confirm authorization. Check that you are allowed to visit and capture the target pages. The applicable permission, privacy, and retention rules depend on the site and audit; the sources cited here do not establish them for a particular NGO.
  3. Choose viewports. Record the window dimensions for each capture. A browser window size is not necessarily identical to the page’s CSS viewport across browser environments, so keep the browser setup consistent and note it.
  4. Choose a reproducible setup. Record Selenium and browser versions, URL, viewport, date and time, and relevant page state. This helps another auditor understand and repeat the capture.
  5. Define filenames and a capture log. Use names that identify the page, viewport, and state, then connect each file to its URL and capture conditions.

For example, a small capture plan might include home-desktop-menu-closed.png, home-mobile-menu-open.png, and donate-desktop-validation-error.png. The names describe evidence; they do not imply that the corresponding state passed or failed an accessibility check.

2. Capture a page with Selenium in Python

Install Selenium and make a Chrome WebDriver available in your environment. Selenium’s driver management behavior depends on your installed Selenium version and environment; use the official setup guidance if driver discovery does not work. This example uses Selenium’s documented WebDriver screenshot method.

from pathlib import Path
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait

out = Path("screenshots")
out.mkdir(parents=True, exist_ok=True)

options = webdriver.ChromeOptions()
# Uncomment to run Chrome without a visible browser window:
# options.add_argument("--headless=new")

driver = webdriver.Chrome(options=options)
try:
    driver.set_window_size(1365, 900)
    driver.get("https://example.org/")

    # Wait for the document to finish loading. This does not guarantee that
    # every image, animation, or client-rendered component is ready.
    WebDriverWait(driver, 20).until(
        lambda d: d.execute_script("return document.readyState") == "complete"
    )

    saved = driver.save_screenshot(str(out / "home-desktop.png"))
    if not saved:
        raise RuntimeError("WebDriver did not save the screenshot")
finally:
    driver.quit()

Replace https://example.org/ with an authorized target URL. Selenium’s save_screenshot captures the current browser window as a PNG. The WebDriver screenshot endpoint returns screenshot data encoded in Base64; the Python method saves it to the given file. Selenium also documents screenshots of individual elements. See the Selenium screenshot documentation.

Wait for the content or state you need

document.readyState == "complete" is a useful baseline, but dynamic sites can render content after that point. Wait for a meaningful element or state that belongs to the capture plan:

from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait

# After driver.get(url):
WebDriverWait(driver, 20).until(
    EC.visibility_of_element_located((By.CSS_SELECTOR, "main h1"))
)
driver.save_screenshot("screenshots/programs-desktop.png")

Choose a selector that indicates the relevant content is ready. If the page has no reliable readiness marker, use a bounded wait appropriate to the site and document it. A fixed delay may be needed for a known animation or delayed element, but long arbitrary sleeps make a capture run slower without ensuring the right state.

3. Capture an element or an interaction state

A full-window screenshot is useful for page context. An element screenshot can focus evidence on a specific component, such as a form, navigation region, or notice. It does not replace a full-page review when surrounding context matters.

from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait

form = WebDriverWait(driver, 20).until(
    EC.visibility_of_element_located((By.CSS_SELECTOR, "form#donate"))
)
form.screenshot("screenshots/donate-form.png")

For an interactive state, perform the action before capturing and verify that the expected state appeared:

from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait

menu_button = WebDriverWait(driver, 20).until(
    EC.element_to_be_clickable((By.CSS_SELECTOR, "button[aria-expanded]"))
)
menu_button.click()

WebDriverWait(driver, 10).until(
    lambda d: menu_button.get_attribute("aria-expanded") == "true"
)
driver.save_screenshot("screenshots/home-desktop-menu-open.png")

Adapt selectors to the target page. A click succeeding does not establish that the control is accessible by keyboard or assistive technology; those behaviors require separate checks.

4. Make captures repeatable and interpretable

Keep a capture log alongside the image files. At minimum, record:

  • Evidence filename and full URL.
  • Capture date and time, with timezone.
  • Browser name and version, Selenium version, and operating system when relevant.
  • Configured window dimensions and whether the browser was headless.
  • Page state, including interactions or form values needed to reproduce it.
  • Any issue during loading or capture, such as a timeout or blocked content.

For repeated audits, preserve the same capture plan and environment where practical. Websites change, and third-party content, personalization, timing, and network conditions can also change what the browser displays. Record what happened rather than treating two images as directly comparable when their capture conditions differed.

5. Use screenshots as supporting accessibility evidence

Review the page and its interactions against the applicable accessibility criteria, then attach screenshots where they help explain a finding. The W3C distinguishes the normative WCAG technical standard from supporting material that is informative rather than normative. Use the standard itself for conformance requirements and supporting resources as guidance. See the WCAG 2.2 specification and the W3C WCAG overview.

A visible image cannot establish keyboard operability, screen-reader output, semantic markup, focus order, or every other relevant behavior. For example, a screenshot may show a visible form error, but cannot show whether the error is programmatically associated with its field or announced to a screen-reader user. Record findings separately with the criterion, observed behavior, reproduction steps, and relevant evidence.

6. Check whether GIGW applies to the organization

India’s Guidelines for Indian Government Websites and Apps (GIGW) 3.0 are framed for government websites and apps at central, state, district, and local levels. The scope material says the guidance draws on WCAG 2.1, the Rights of Persons with Disabilities Act, 2016, and the Information Technology Act, 2000. Do not assume GIGW automatically governs an independent NGO just because its website is in India. Check whether the organization or service falls within the relevant government scope or obligation. See the official GIGW portal and its scope guidance.

GIGW materials connect their accessibility criteria to WCAG and describe evaluation and STQC website quality certification in the government website context. Do not promise GIGW certification to an NGO without checking eligibility and current STQC requirements. See the official GIGW materials for the applicable evaluation context.

7. Other capture options and audit tradeoffs

Need Selenium approach What to account for
Current browser window driver.save_screenshot(path) Captures the current window and state; set and record the viewport.
A component Find a WebElement, then call its screenshot(path) method Capture may omit surrounding context needed to explain the finding.
Interactive state Perform the interaction, wait for the expected state, then save Record the action and state so it can be repeated.
Delayed content Wait for a meaningful selector or state before saving Page load completion alone may not mean client-rendered content is ready.
Multiple pages Repeat a documented capture plan for each URL Keep per-page logs and make cleanup happen even if a capture fails.

The examples above capture the current window or a single element. If an audit specifically needs a full-page image, confirm that the chosen browser and capture method produce the intended document coverage; a window screenshot should not be assumed to include content outside the visible viewport.

8. Troubleshooting

Symptom Likely cause Fix
Chrome fails to start or Selenium reports a driver error Browser and driver setup is missing or incompatible with the environment. Install a supported browser, follow Selenium’s official driver setup for your version, and check that the process can locate the browser binary.
The screenshot file is missing The output directory does not exist, the path is wrong, or the save operation failed. Create the directory first, use an explicit path, check the method’s return value, and confirm the process can write there.
The page is blank or incomplete Navigation failed, content is still loading, or the site depends on a later client-side render. Check the current URL and browser errors, wait for a page-specific element, and capture only after verifying the intended content is visible.
The menu or validation state is absent The interaction did not trigger, or the script saved before the resulting state appeared. Check that the target control is clickable, perform the action, wait for an observable state change, and log the state.
An element lookup times out The selector is incorrect, the element is inside a frame, or the page has not reached the expected state. Inspect the page structure, verify the selector, switch into the correct frame if applicable, and wait on the actual state required.
Repeated captures differ Viewport, timing, page content, third-party resources, or interaction state changed. Record browser and capture conditions, stabilize the intended state, and note differences that cannot be controlled.
The image cannot demonstrate the reported issue The issue concerns behavior that a static image cannot show. Record steps, keyboard behavior, semantic or assistive-technology observations separately, and use the screenshot only as supporting evidence.

9. Performance, reliability, and cost

Capture runs are browser-driven: each navigation, readiness wait, and interaction adds time. Keep waits bounded, reuse a documented browser setup when processing multiple pages, and avoid waiting for an arbitrary long period when a specific page condition can be checked. Always close the WebDriver in a finally block so the browser process is shut down if navigation or saving raises an error.

Reliability depends on what the page loads and on the environment. Network failures, CAPTCHA or bot checks, third-party scripts, personalization, and changing site content can alter or prevent a capture. Log failures instead of silently treating an empty or partial image as valid evidence. No benchmark or capture-time guarantee is implied here.

Selenium is open-source browser automation software; this workflow does not add a per-screenshot service charge from ScreenshotNeo. Your operational costs can include the machine or hosted browser environment, engineering time, and any services used to run the audit. Keep a record of failed runs and reruns so audit effort is visible.

10. Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server for developers. A GET request returns a PNG, JPEG, WebP, or PDF. Here is the one-call example for a public page; see the ScreenshotNeo API documentation for the available parameters and formats.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
  • Cookie banners are accepted and removed before capture, along with 60+ known consent platforms, newsletter popups, and chat widgets; each cleanup step can be turned off.
  • Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed. Response headers identify the page verdict and billing status.
  • An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.
  • The free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 screenshots.

For an audit, record the URL, viewport and state parameters used, and retain the returned file with the same evidence log you would use for Selenium. ScreenshotNeo automates capture; it does not determine WCAG conformance or replace testing of keyboard, screen-reader, and semantic behavior. Sign up for 1,000 free screenshots a month with no card.

11. Frequently asked questions

Does a Selenium screenshot prove that a page passes WCAG?

No. It records visual output in one browser context. Assess applicable criteria and interactions separately, then use the image as supporting evidence where it helps explain an observation.

Should an Indian NGO use GIGW for its audit?

First check whether the organization or service falls within GIGW’s government scope or another relevant obligation. The fact that a site belongs to an NGO in India does not by itself establish GIGW applicability.

Can a screenshot show what a screen reader announces?

No. A screenshot cannot record screen-reader output. Test and document assistive-technology behavior separately.

Can Selenium capture one specific component?

Yes. Locate the element and call its WebElement screenshot(path) method. Keep a full-window image too when the surrounding page context matters.

What should accompany an audit screenshot?

At least the URL, date and time, browser and Selenium versions, viewport dimensions, page state, and a clear link to the finding or test step it supports.

Primary sources