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 DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
FREEDOM251

Freedom251 › Blog › Indian real estate

How to Automate Selenium Screenshots of Indian Real Estate Listing Pages

By Freedom251 Team · · 7 min read

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

Use Selenium WebDriver to open an explicitly chosen property-listing URL, wait for the content you need, and save either the browser window or a specific element as a PNG. Before automating any portal, check its current terms and your planned use of the images: Selenium can control a browser, but that does not grant permission to automate a site or reuse its content.

Check permission before you automate

Identify the portal, the pages you intend to capture, how often you will visit them, and what you will do with the screenshots. Read that portal’s current terms and obtain permission where required. Rules differ by site; do not assume that a public listing page is available for automated capture or republication.

As an Amazon Associate I earn from qualifying purchases.

For example, eRealtor’s terms state that they are governed by Indian law and in force from 25 July 2026. They prohibit bots, crawlers, and automated tools against the platform except ordinary public-search-engine indexing, and prohibit scraping, copying, or republishing listings and media without written permission. Those terms apply to eRealtor, not to every Indian property portal. Read eRealtor’s terms before considering any activity there.

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

Permission for other portals depends on their own current terms and your intended use. Selenium documentation likewise cautions against link spidering; a defined list of pages for an authorized task is a better fit than crawling a portal. Selenium’s link-spidering guidance.

Set up a small, controlled Selenium workflow

Selenium describes WebDriver as its browser-control interface. For a repeatable capture, use one driver session, navigate directly to each URL you are authorized to visit, wait for the page condition relevant to the image, save the screenshot, and close the session. The example below uses Python and Selenium’s documented window and element screenshot methods. Selenium WebDriver documentation.

Install Selenium and a compatible browser

Install Selenium in the Python environment you will use, and make sure a browser supported by your Selenium setup is available. The code assumes your browser and driver setup can start a Chrome session. Selenium’s official documentation describes the browser-driver workflow; consult it if your local installation needs additional configuration.

python -m pip install selenium

Capture a full window or a listing element

Set CAPTURE_MODE to window for the current browser window or element to save a selected listing block. Replace the sample URL and selector with a page and locator you are permitted to use. The selector is illustrative: no particular portal’s markup or loading behavior is established here.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
The Millionaire Real Estate Investor
  • Business & Economics
  • Real Estate
from pathlib import Path
from urllib.parse import urlparse

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

URL = "https://example.com/property-listing"
CAPTURE_MODE = "window"  # Change to "element" to capture a listing element
ELEMENT_SELECTOR = "[data-testid='listing-card']"  # Replace with stable page markup
OUTPUT_DIR = Path("screenshots")

OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
# Use the host in the filename so captures from different portals are distinguishable.
host = urlparse(URL).netloc.replace(".", "_") or "page"
output_path = OUTPUT_DIR / f"{host}_listing.png"

driver = webdriver.Chrome()
try:
    driver.get(URL)
    wait = WebDriverWait(driver, 20)

    if CAPTURE_MODE == "element":
        target = wait.until(
            EC.visibility_of_element_located((By.CSS_SELECTOR, ELEMENT_SELECTOR))
        )
        success = target.screenshot(str(output_path))
    elif CAPTURE_MODE == "window":
        # Replace this condition with a stable heading or other readiness signal
        # if the page renders listing content asynchronously.
        wait.until(EC.presence_of_element_located((By.TAG_NAME, "body")))
        success = driver.save_screenshot(str(output_path))
    else:
        raise ValueError("CAPTURE_MODE must be 'window' or 'element'")

    if not success:
        raise RuntimeError(f"Selenium could not save screenshot: {output_path}")
    print(f"Saved {output_path}")
finally:
    driver.quit()

Selenium’s Python API documents save_screenshot(filename) as saving the current window in PNG format and returning whether the save succeeded. Element screenshots are also supported. Python WebDriver API reference and Selenium element interaction documentation.

Choose the right screenshot scope

Capture Use it when Trade-off
Browser window You need the visible page context around a listing, such as the surrounding layout. It captures the current window rather than isolating one chosen listing element.
Element You need a particular card or content block as the artifact. You must identify the intended element with a locator that matches the page’s actual markup.

The Python API method in the example saves a window screenshot as PNG. Inspect the output to confirm that the visible content and page state match your purpose; a successful save does not itself establish that the intended listing had finished loading.

Wait for the content you intend to capture

Property pages may render content asynchronously or show overlays. A page being navigable is not proof that its listing content is ready. Pick a condition that corresponds to the image you need—such as visibility of the listing heading or target card—and wait for it before taking the screenshot. In the example, element mode waits for the target element to become visible.

For window mode, the example waits only for the document body. That is a minimal readiness check, not a guarantee that a listing or its images have loaded. If those matter, replace it with a wait for a stable heading, card, or other relevant condition. A fixed sleep can delay the capture, but does not prove the page reached the state you need. The sources do not establish the markup or loading behavior of any particular Indian listing portal.

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

Use locators that can survive modest page changes

Selenium recommends a unique, predictable ID when one is available; otherwise, a concise CSS selector is a preferred option. Validate a locator against the specific page you intend to capture, and avoid relying on generated styling classes unless you have checked that they are stable. Complex DOM traversal can make XPath harder to debug. Selenium locator guidance, last modified 10 February 2022.

  • Prefer a unique stable ID if the target exposes one.
  • Otherwise, use a short CSS selector grounded in stable page markup.
  • Check that the selector identifies the intended card, not a similar listing or repeated element.
  • When a locator stops matching, inspect the page and update it rather than adding increasingly fragile DOM traversal.

Handle multiple authorized URLs without turning the script into a crawler

For a defined capture task, keep intended URLs explicit. Avoid following every link or expanding the script into broad site crawling. If you have multiple authorized pages, use a controlled URL list and choose a distinct filename for each capture so later files do not overwrite earlier ones. Confirm the permitted visit frequency and retention or reuse of the resulting screenshots with the portal’s terms or rights holder.

When a local browser is enough—and when to use Grid

A single local browser is a reasonable starting point for one repeatable capture path. Selenium Grid is infrastructure for allocating browsers across browsers and operating systems, which becomes relevant when the task genuinely requires cross-browser coverage or distributed execution. It is not necessary just to save a screenshot from one browser. Selenium Grid documentation.

Troubleshoot common capture failures

  • The driver cannot start: Check that your browser and Selenium setup are compatible and configured to launch a session. Consult Selenium’s WebDriver setup documentation for the browser-driver workflow.
  • The element wait times out: The selector may not match the current page, the element may not become visible, or the page may be different from the one expected. Inspect the authorized target page and validate a stable ID or concise CSS selector.
  • The screenshot exists but misses listing content: The capture condition may only confirm that the body is present. Wait for the actual heading, card, or other content needed in the image.
  • The saved file is empty or the save reports failure: Check the method’s returned success value and the output path. Ensure the destination directory exists and inspect the image before relying on it.
  • Later captures replace earlier ones: The script is reusing a filename. Generate a collision-resistant name for each intended URL, for example by including a listing identifier or a controlled sequence number.
  • A portal blocks or forbids automation: Do not try to evade its controls. Check the portal’s terms and obtain the required authorization before continuing.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. A GET request with a URL can return a PNG, JPEG, WebP, or PDF. Its clean-shot workflow accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and the response identifies the page verdict and billing status in headers. An MCP server offers take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.

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

Example cURL request, using the target URL from this article’s sample:

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

See the ScreenshotNeo API documentation for setup and request options. A portal’s terms still determine whether automated capture is permitted; using an API does not grant rights to capture or republish a listing.

The free plan includes 1,000 screenshots per month with no card required; paid plans start at $5 for 3,000. Sign up for ScreenshotNeo’s free plan.

Frequently Asked Questions

What file format does Selenium’s Python window screenshot method save?

The documented save_screenshot(filename) method saves the current window as a PNG.

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

Does Selenium Grid have to be used for a single screenshot?

No. A local browser can handle a single repeatable capture path; Grid is for scaling browser allocation across browsers and operating systems.

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.

Indian real estatePythonscreenshot automationSeleniumWeb scraping ethicsWebDriver

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
PC Slower Than It Used to Be?Free scan - under a minute

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.