ScreenshotNeo

BlogHow-to

How to Take Screenshots of Indian Restaurant Websites with Selenium for a Portfolio

Capture repeatable restaurant website screenshots with Selenium. Save browser-window or element images and prepare them clearly for a portfolio.

By the ScreenshotNeo team4 October 20267 min read

Use Selenium’s Python WebDriver to open a restaurant page, set a consistent browser-window size, and save a PNG with driver.save_screenshot(). That captures the current browser window; it should not be described as a full-page screenshot unless the browser and driver method you choose explicitly support full-page capture. To capture a focused part of the page, locate an element and call its screenshot() method. Selenium documents both methods in its Python WebDriver API and WebDriver guide.

1. Set up Selenium and capture a browser window

Install Selenium in your Python environment:

python -m pip install selenium

Save this as capture_restaurant.py. Replace the example URL with a page you have selected for your portfolio.

from pathlib import Path
from selenium import webdriver

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

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

driver = webdriver.Chrome(options=options)
try:
    driver.set_window_size(1440, 1000)
    driver.get("https://example-restaurant.in/")

    saved = driver.save_screenshot(str(output / "example-restaurant-home.png"))
    if not saved:
        raise OSError("Selenium could not save the screenshot")
finally:
    driver.quit()

Selenium Manager can manage browser drivers for standard Selenium installations. If your environment uses a manually installed browser or a remote WebDriver, configure that environment accordingly. The example uses Chrome, but Selenium supports multiple browser drivers; the exact setup depends on the browser and execution environment.

2. Capture a specific page element

For a portfolio image focused on a menu, hero, or other component, find an element and save its screenshot. This example targets the page’s main element:

from pathlib import Path
from selenium import webdriver
from selenium.webdriver.common.by import By

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

driver = webdriver.Chrome()
try:
    driver.set_window_size(1440, 1000)
    driver.get("https://example-restaurant.in/")

    main = driver.find_element(By.TAG_NAME, "main")
    main.screenshot(str(output / "example-restaurant-main.png"))
finally:
    driver.quit()

Not every page has a main tag. Inspect the page and choose a locator that exists, such as a CSS selector:

hero = driver.find_element(By.CSS_SELECTOR, ".hero")
hero.screenshot("screenshots/example-restaurant-hero.png")

Element screenshots are useful when the portfolio needs to show one component without surrounding page content. If the locator matches no element, Selenium raises a no-such-element error; use a selector that matches the live page and wait for client-rendered content when needed.

3. Make portfolio captures consistent

  1. Choose the pages. Record each restaurant site and page you intend to feature. This research did not test particular restaurant websites.
  2. Fix the viewport. Use the same window dimensions for comparable captures. The requested window size is part of the capture setup; keep it consistent across runs.
  3. Decide what the image represents. Use a window capture for the visible browser window or an element capture for a particular component. Do not label a current-window image as full page without verifying that your selected browser and method capture the whole page.
  4. Use descriptive filenames. Include the site or project name and page, for example restaurant-home.png or restaurant-menu.png.
  5. Keep a capture record. Note the page URL, access date, viewport dimensions, browser, and whether the image is a window or element capture. This helps a portfolio reviewer understand what the image shows.

4. Choose the right capture scope

Capture What it shows Good fit Check
Browser window The current browser window A page composition at a stated viewport It is not automatically a full-page capture.
Element A located page element A hero, menu, logo, or other focused component The locator must match an element on that page.
Full page The full scrollable page, if the chosen method supports it A long page overview Support depends on the browser and driver method. Confirm support before relying on it.

The Python API describes save_screenshot(filename) as saving the current window. Selenium’s Ruby API documents full-page capture as conditional on driver support, which illustrates why you should check the exact binding and browser behavior instead of assuming all screenshot methods are full-page.

5. Wait for the page state you want

A screenshot reflects the page state at the moment Selenium captures it. A page load returning does not guarantee that every image, font, animation, or client-rendered section has reached the exact visual state you want. For a known element, use an explicit wait:

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

menu = WebDriverWait(driver, 15).until(
    EC.visibility_of_element_located((By.CSS_SELECTOR, ".menu"))
)
menu.screenshot("screenshots/restaurant-menu.png")

Choose a selector that represents the content you need. A fixed delay can be used for a known animation or delayed transition, but it adds the full delay to every run and still cannot guarantee a particular state. For repeatable portfolio comparisons, avoid capturing while a rotating carousel, video, or animation is in an arbitrary frame; use an appropriate stable state if the site provides one.

6. Run the same workflow for several sites

For a small portfolio batch, keep URLs and filenames in a list and create a fresh capture per page. This example records individual errors and continues with the remaining entries:

from pathlib import Path
from selenium import webdriver

pages = [
    ("restaurant-one", "https://example-restaurant.in/"),
    ("restaurant-two", "https://example.com/"),
]
output = Path("screenshots")
output.mkdir(parents=True, exist_ok=True)

options = webdriver.ChromeOptions()
options.add_argument("--headless=new")

driver = webdriver.Chrome(options=options)
try:
    driver.set_window_size(1440, 1000)
    for name, url in pages:
        try:
            driver.get(url)
            if not driver.save_screenshot(str(output / f"{name}-home.png")):
                print(f"Could not save screenshot for {url}")
        except Exception as exc:
            print(f"Capture failed for {url}: {exc}")
finally:
    driver.quit()

For a larger or more failure-prone batch, consider isolating each URL in its own browser session so that a stuck page does not hold up later captures. Track failures and retry selectively rather than silently treating every output file as a valid capture.

7. Troubleshooting

Symptom Likely cause What to do
Browser fails to start Browser or driver is unavailable, incompatible, or blocked by the runtime. Confirm the browser is installed and supported in the environment. Check Selenium’s startup error for the driver path or compatibility problem.
No screenshot file appears The output directory is missing, the path is wrong, or saving returned false. Create the directory first, use a writable path, and check the boolean result from save_screenshot().
Element not found The selector does not match, the site uses different markup, or the content has not rendered yet. Inspect the page, update the locator, and wait for the element with an explicit wait.
Screenshot is cut off below the fold The method captured the current window rather than a full page. Use the documented full-page capability for your chosen browser and binding, or capture sections separately. Do not assume the window method captures the full scrollable page.
Screenshot shows a loading state or missing images Capture occurred before the desired content appeared or loaded. Wait for a meaningful element or known state. If image completeness matters, verify the result visually; a generic page-load event is not proof every asset has loaded.
Run hangs on one page A page or resource may be slow or unresponsive. Set appropriate page-load and script timeouts for the workflow, record the failing URL, and continue or retry according to your batch policy.

8. Reliability, performance, and cost

Local Selenium captures use your browser session and machine resources. Browser startup and page loading are usually the costly parts of a run; reusing one driver for a modest batch avoids repeated startup overhead, while separate sessions can isolate failures. Keep concurrency within the CPU, memory, and browser capacity available to your machine. A headless browser can run without a visible window, but compare its result with your intended portfolio output if rendering differences matter.

Selenium itself does not establish whether you may republish a restaurant’s website design, photography, logos, or text. The research did not establish a legal conclusion or check the terms of any particular Indian restaurant site. Check the site’s terms and permissions for the pages you choose, describe the capture accurately, and credit or link to the source when useful.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. Its API can return an image or PDF from one GET request. See the ScreenshotNeo API documentation.

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

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

Cookie banners are accepted and removed before the shot, along with more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks, blank pages, and failed loads are never billed, and response headers report the page verdict and billing status. AI agents can take screenshots through its MCP server. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Plans are also available at $15 for 15,000, $39 for 60,000, $99 for 250,000, and $249 for 1,000,000; annual billing gives two months free. Every feature is on every plan. Sign up for 1,000 free screenshots a month with no card.

FAQ

Does save_screenshot() save JPEG?

The documented Python method saves a PNG. Use a conversion step if your portfolio requires another image format.

Yes. Locate the element with a suitable Selenium locator and call its screenshot() method.

Should the portfolio image include the browser chrome?

The documented WebDriver screenshot captures the current browser window content. If you need a framed presentation, create that separately and label it as a presentation mockup rather than a raw browser capture.