ScreenshotNeo

BlogHow-to

How to Capture Selenium Screenshots of Indian Court Case Status Pages

Use Selenium to look up an Indian court case, wait for its status to appear, and save a full-page or result-only screenshot reliably.

By the ScreenshotNeo team4 October 20267 min read

Use Selenium WebDriver to open the official service for the court you need, submit a lookup using that page’s supported controls, wait for the case result to become visible, then save a browser screenshot or a screenshot of the result element. Selenium provides driver.save_screenshot(...) for the browser view and element.screenshot(...) for a specific element. Court portals do not share one universal layout or locator, so inspect the selected service and adapt the URL, search steps, and selectors.

This guide covers the Selenium workflow in Python, how to choose a lookup and screenshot scope, waits, troubleshooting, and operational considerations. For a fresh case status, use the official court service; an image records only what was visible at capture time.

1. Identify the official court service and lookup route

The e-Committee’s eCourts Services Portal is a gateway to High Court and District Court services. Case lookup options described by the portal include case number, FIR number, party name, advocate name, filing number, Act, and case type. Daily orders and final judgments are also available through several lookup parameters. The official app help documents court selection for High Court, District Court, or both, and lists CNR search alongside several of these alternatives. After a successful search, case history can include case details, status, hearing history, and orders.

These are a family of services, not one uniform page. Court selection, available fields, and result markup vary. First choose the court and official service that match the case, then inspect that page’s current search form and result area. Do not assume that a selector or workflow from one court works on another.

  • Prefer a CNR lookup when the selected service offers it and you have the CNR.
  • Otherwise use a route that the selected page supports, such as case number, filing number, party or advocate name, FIR number, Act, or case type.
  • Confirm the result identifies the intended case before saving an image.

Sources: eCourts Services Portal and official eCourts service information. See also the official app help and FAQ.

2. Install Selenium and a browser

Use a supported browser and its WebDriver setup for your environment. Selenium’s documentation describes installation and browser setup; current setup details can vary by browser and Selenium version, so consult the official Selenium documentation. Install the Python package with:

python -m pip install selenium

The example below uses Selenium’s Chrome driver interface and a placeholder result selector. Selenium Manager may manage driver setup for supported configurations; if your environment requires a separately managed driver, follow Selenium’s browser setup documentation.

3. Run a lookup, wait for the result, and save screenshots

Replace the example URL, search interaction, and CSS selector with the controls from the specific official court service you selected. The example shows the synchronization and capture pattern; it is not a universal court-portal script.

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

options = webdriver.ChromeOptions()
# For a server environment, uncomment if appropriate:
# options.add_argument("--headless=new")

driver = webdriver.Chrome(options=options)
try:
    driver.set_window_size(1440, 1000)
    driver.get("https://services.ecourts.gov.in/")  # Replace with the selected official service.

    wait = WebDriverWait(driver, 20)

    # Add the court-specific interaction here: select the court, choose a
    # supported search route, enter the lookup value, and submit the form.
    # Example only; replace the selector and value for the selected page:
    # driver.find_element(By.NAME, "cnr").send_keys("YOUR_CNR")
    # driver.find_element(By.CSS_SELECTOR, "button[type='submit']").click()

    result = wait.until(
        EC.visibility_of_element_located((By.CSS_SELECTOR, ".case-result"))
    )

    # Whole current browser view, including surrounding page context.
    driver.save_screenshot("case-status.png")

    # Focused result element, useful when only the case block is needed.
    result.screenshot("case-result.png")
finally:
    driver.quit()

The URL, commented form interactions, selector, and 20-second timeout are illustrative. Check the target page’s current markup and replace .case-result with a locator that identifies the actual case-history or result container. Selenium supports browser and element screenshots; its WebDriver screenshot endpoint represents image data in Base64 before the binding saves it to a file.

Use condition-based waits

A navigation completing does not guarantee that JavaScript-driven case results have rendered. Wait for a result-specific condition such as visibility of the case-history heading, a result container, or a stable identifier within the result. Selenium’s explicit waits poll for a stated condition. Avoid mixing implicit and explicit waits, which Selenium warns can produce unpredictable wait times.

Use a fixed sleep only when the page provides no observable readiness condition and you have characterized the delay; it is less reliable than waiting for the state you need. Increase the explicit timeout only to accommodate the target service’s observed response times, and handle a timeout as a failed capture rather than saving a misleading intermediate page.

4. Choose the screenshot scope

Method Use it when Considerations
driver.save_screenshot("case-status.png") The surrounding page, court context, or visible navigation matters. Captures the browser’s current view. Set a consistent viewport when comparing runs.
element.screenshot("case-result.png") The result block alone is sufficient and easier to review. Choose a locator that encloses all relevant fields and verify it is visible before capture.

Capture only after the relevant text is visible. A focused element image can omit useful context, while a browser-view capture may include unrelated page content. Choose the smallest scope that still lets a reader understand what is being shown.

5. Make captures reproducible and responsible

  • Record the selected court service, lookup route, capture time, and whether the image shows the browser view or a result element.
  • Keep the viewport and browser setup consistent for comparisons.
  • Do not present a screenshot as proof that case information remains current. It is a point-in-time record; use the official service for a fresh lookup.
  • Check the current terms of the exact court site before recurring automated access or redistributing captures. The reviewed sources do not establish one shared automation or republication rule for every portal.

The official FAQ notes that an active internet connection is needed to access updated case information. Portal interfaces and terms can change, so re-check the chosen service before deploying a recurring job. If its terms do not answer whether your planned automation is permitted, ask the site administrator.

6. Troubleshooting

Symptom Likely cause Fix
Timeout waiting for the result The selector is wrong, the lookup did not submit, the case was not found, or the service is slow. Inspect the page and browser logs, confirm the lookup route and submission, and wait on a real result-specific locator. Handle no-result states separately.
Screenshot shows a loading page or old content The capture ran after navigation but before dynamic results finished rendering. Wait for the result or case-history element to become visible; do not treat page-load completion alone as readiness.
NoSuchElementException The locator does not match this court page, the control is in a frame, or it has not rendered yet. Inspect the current DOM, adapt the locator, wait for the control, and switch into the appropriate frame if the page uses one.
Driver or browser startup error The browser is missing, incompatible, or the driver setup is unavailable in the environment. Install a supported browser and follow the Selenium setup instructions for that browser and runtime.
Element screenshot is empty, clipped, or fails The chosen element is hidden, outside the expected layout, or the locator targets the wrong container. Wait for visibility, verify the selected element, and capture the browser view if the focused region cannot be captured reliably.
Portal presents a verification challenge The service is asking for human verification or applying an access control. Do not attempt to bypass the challenge. Follow the portal’s permitted process and its terms.

7. Performance, reliability, and cost

For a single lookup, the main time cost is the court service’s response and rendering, not writing the image file. Reuse a browser session only when that fits the court site’s terms and your operational needs; always close sessions in a finally block so failed lookups do not leave browser processes behind. A result-specific wait improves reliability by avoiding both premature captures and arbitrary long pauses.

For recurring captures, track timeouts and no-result outcomes separately from successful screenshots. Keep a record that identifies the service and capture time, and verify that the selected portal permits the access pattern and storage or redistribution you intend. No general rate limit, automation permission, or cost rule applies across all court pages based on the sources reviewed; confirm details for the exact service and your hosting environment.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server for developers. Its API takes a URL and returns an image or PDF; see the API documentation. For a public court page, a one-call capture looks like this:

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

Cookie banners, popups, and chat widgets are removed before the shot. Bot checks, blank pages, and failed loads are never billed. An MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Use the service only for pages and access patterns permitted by the relevant court portal.

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

FAQ

Can Selenium capture only the case result?

Yes. Locate the result container, wait until it is visible, then call element.screenshot("case-result.png").

Does one locator work on every Indian court status page?

No. Court services differ in their search controls, page structure, and result markup. Inspect the specific official service and adapt the locator and lookup workflow.

Does a screenshot show the current case status?

It shows what the page displayed at the capture time. Visit the official service and perform a fresh lookup to check updated information.

Should I use a fixed delay before capturing?

Prefer an explicit wait for the result state. A fixed delay can be too short on a slow response and unnecessarily long when results load quickly.