ScreenshotNeo

BlogHow-to

How to Install ChromeDriver for Selenium Screenshots on Ubuntu in India

Set up Selenium screenshots on Ubuntu with Selenium Manager or a manually matched ChromeDriver, then troubleshoot browser discovery, versions, and headless runs.

By the ScreenshotNeo team4 October 20269 min read

Direct answer: For most current Selenium setups on Ubuntu, install Selenium 4.6 or newer and a discoverable Chrome or Chromium browser; Selenium Manager can download the matching ChromeDriver automatically. Install ChromeDriver manually only when you need to pin or control its location. For Chrome 115 and later, select a matching driver using Chrome for Testing’s release data. These steps are the same in India as elsewhere; the sources do not identify an India-specific driver or installation method.

1. What ChromeDriver does

ChromeDriver is a separate executable that implements the browser-control path Selenium WebDriver uses to operate Chrome. Selenium is the automation library; Chrome or Chromium is the browser; ChromeDriver connects Selenium to that browser. All three parts must be available and compatible for a screenshot script to work. Chrome’s ChromeDriver guide

Installing a driver is not the same as installing a browser. A successful driver lookup also does not prove that Chrome can render in a headless server session; browser startup, fonts, permissions, and page loading can still fail.

2. Choose an installation path

Path Good fit Tradeoff
Selenium Manager Routine local development and scripts where automatic driver resolution is acceptable Needs to discover the browser and, when required, reach Selenium Manager’s driver metadata and download sources
Manual driver on PATH Systems where a centrally managed executable is convenient You must keep browser and driver versions compatible
Manual driver via Service Reproducible jobs that need an explicit driver path Your deployment must keep that path and binary present

Selenium 4.6 and later includes Selenium Manager, which can obtain an appropriate driver. Start there unless you have a reason to pin a binary. See Selenium Manager documentation and Selenium’s driver troubleshooting guide.

3. Install the browser and Selenium on Ubuntu

Install a Chrome or Chromium browser first and confirm its executable is available. Ubuntu Chromium packaging varies by Ubuntu release. Do not assume that the same apt package command installs a standalone browser and driver on every release. For example, Ubuntu’s Questing package page describes chromium-chromedriver as transitional to the Chromium snap; this is release-specific evidence, not a promise about other Ubuntu releases. Ubuntu Questing package details

  1. Check your release and available browser package instructions using Ubuntu’s package information for that release.
  2. Install Chrome or Chromium using the appropriate official package source for your machine.
  3. Find and verify the browser executable. Common checks include which google-chrome, which chromium, and trying the discovered executable with --version. A snap installation may expose Chromium at /snap/bin/chromium; verify this locally rather than assuming it.
  4. Install Selenium into the same Python environment that will run the screenshot script: python3 -m pip install -U selenium.

Keep Python environments isolated where practical. Installing Selenium with one interpreter and running the script with another can make it look as though the package or its driver support is missing.

4. Capture a screenshot with Selenium Manager (Python)

This runnable example uses Selenium’s Python API, asks Chrome for headless operation, saves a PNG, and closes the browser even if navigation or capture raises an error. It assumes a working Chrome or Chromium installation that Selenium Manager can discover. The headless argument shown is a Chrome browser option; confirm it against the installed browser and environment if startup fails.

from pathlib import Path
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument("--headless")
options.add_argument("--window-size=1440,1000")

# If Chromium is installed at a nonstandard path, uncomment and adjust:
# options.binary_location = "/snap/bin/chromium"

driver = webdriver.Chrome(options=options)  # Selenium Manager resolves the driver
try:
    driver.set_page_load_timeout(60)
    driver.get("https://example.com")
    driver.save_screenshot("screenshot.png")
finally:
    driver.quit()

print(Path("screenshot.png").resolve())

Run it with python3 screenshot.py. Selenium Manager may download a driver the first time it needs one; later runs can use its local cache. If the browser is not in a location it detects, set options.binary_location to the real browser executable. The Selenium Manager behavior and fallbacks are documented in the official Selenium guide.

5. Install ChromeDriver manually when needed

Choose manual installation when you need a fixed driver binary, an explicit path, or an environment where automatic resolution is unavailable. First inspect the browser version, then obtain a Linux driver build matched to it. ChromeDriver is a separate download; do not select a version by guesswork.

For Chrome 115 and newer

Chrome and ChromeDriver release management is integrated for Chrome 115 onward. Use the Chrome for Testing availability data and JSON endpoints to find a compatible build. Chrome’s version-selection guidance also explains how to find matching version metadata for a non-Chrome-for-Testing browser. Start with ChromeDriver version selection and Chrome for Testing downloads and JSON endpoints. The available builds and metadata change over time, so consult the current official data when installing rather than copying a stale version number.

Put the binary on PATH or set a Service path

After downloading the Linux ChromeDriver archive that matches the browser, extract the executable and place it in a directory intended for locally managed executables. Ensure the file is executable and the directory is on the process PATH. Then verify with which chromedriver and chromedriver --version. Follow Chrome’s official setup guidance for platform-specific download and PATH details.

Alternatively, point Selenium explicitly at the binary through the Python binding’s Service object:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service

options = Options()
options.add_argument("--headless")
options.add_argument("--window-size=1440,1000")
# Set this to the actual Chrome or Chromium executable if needed:
# options.binary_location = "/path/to/chrome"

service = Service(executable_path="/path/to/chromedriver")
driver = webdriver.Chrome(service=service, options=options)
try:
    driver.get("https://example.com")
    driver.save_screenshot("screenshot.png")
finally:
    driver.quit()

Replace both paths as appropriate. If you configure a manual Service path, Selenium uses that executable rather than relying on PATH discovery for the driver.

6. Screenshot behavior and useful options

  • Viewport screenshot: save_screenshot captures the current rendered viewport. Set a window size before navigation if consistent dimensions matter.
  • Full-page screenshot: Selenium’s standard screenshot call should not be assumed to stitch an arbitrarily long document into one image. For a full-page capture, use browser-specific DevTools support or scroll-and-stitch with care; account for sticky elements, lazy-loaded images, and pages whose content changes while scrolling.
  • Wait for dynamic content: A successful page navigation may happen before client-side content is ready. Use an explicit wait for a meaningful element rather than an arbitrary long sleep. Example:
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

WebDriverWait(driver, 20).until(
    EC.visibility_of_element_located((By.CSS_SELECTOR, "main"))
)
driver.save_screenshot("ready.png")
  • Page-load timeout: Set driver.set_page_load_timeout(seconds) to cap navigation wait time. A timeout may leave a partially rendered page; decide whether to capture that state or fail the job.
  • Browser binary: Set options.binary_location when Chrome/Chromium is installed outside the location Selenium detects.
  • Headless mode: Use only if the installed browser supports the selected headless mode. A driver can be installed correctly while browser startup still fails.
  • Output path: Use an absolute or known writable path in scheduled jobs. A relative filename is written relative to the process working directory.

For the exact Selenium API and options supported by your installed binding, consult the Selenium documentation.

7. Ubuntu, India, and network considerations

There is no separate India-specific ChromeDriver binary in the cited guidance. Use the normal Linux selection and compatibility process. If your network or organization restricts access to browser or driver downloads, Selenium Manager may be unable to resolve or fetch a driver; use an approved download path and configure a manually managed driver. Do not treat this as a geographic product difference.

Ubuntu Chromium may be delivered through a snap depending on release and package policy. A Selenium Manager blog example from October 2023 found snap Chromium at /snap/bin/chromium, but that is a dated example tied to that Manager version, not a guarantee for current systems. Selenium Manager status in October 2023

8. Troubleshooting

Symptom Likely cause What to do
“Unable to locate driver” Old Selenium, browser not found, driver missing, or Manager cannot download metadata/binary Upgrade Selenium to 4.6 or newer; verify browser executable and network access; inspect Selenium Manager logs; alternatively configure a matched driver explicitly. Selenium guide
“This version of ChromeDriver only supports Chrome version …” Driver and browser major versions do not match Check both --version outputs and select a compatible build using Chrome’s current version-selection guidance, especially for Chrome 115+.
Browser executable not found Chrome/Chromium is absent or installed outside Selenium’s discovery locations Find the actual executable, verify it runs, and set options.binary_location.
Chrome starts locally but fails on a server Headless/browser environment differences, missing runtime dependencies, permissions, or an unsupported argument Read the full browser startup error, verify the installed browser can launch in that environment, and add only flags supported by that browser. Driver installation alone does not resolve display or runtime problems.
Screenshot is blank or incomplete Capture happened before the page rendered, navigation timed out, or content is lazy-loaded Wait for a page-specific element, inspect the page state and console/log output, and scroll or otherwise trigger lazy content before capture when appropriate.
Works in a shell, fails in a service or cron job Different PATH, Python environment, working directory, user permissions, or network policy Log the executable paths and versions from the job context; use explicit paths and an absolute output filename; ensure the service user can execute the browser and write the output.
Ubuntu package installs a snap or transitional package Package behavior differs by Ubuntu release Check the package page for the exact Ubuntu release and verify the installed browser path and version. Do not reuse Questing-specific package behavior as universal guidance.

9. Performance, reliability, and cost

A local Selenium screenshot job consumes CPU and memory for a browser process. Reuse one browser session for multiple pages when isolation requirements allow, but create fresh sessions when state, cookies, or failures could leak between captures. Close every session with quit(). Set navigation and explicit-wait time limits so one slow page does not hold a worker indefinitely. For parallel jobs, cap concurrency based on available memory and ensure each worker has a safe output filename.

The software path described here uses Selenium, a browser, and ChromeDriver; the cited installation sources do not specify usage charges. Your operational costs are the machine, storage, and engineering time needed to maintain browser versions, dependencies, retries, and job capacity. Pinning a manual driver improves control but creates a version-update task; Selenium Manager reduces routine driver selection work but depends on successful discovery and download when needed.

10. Or skip the browser setup

For a one-request screenshot API, ScreenshotNeo accepts a URL and returns an image or PDF. Its cookie cleanup accepts consent banners and removes 60+ known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Only clean shots are billed: bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and responses identify the outcome in X-Page-Verdict and X-Billed headers. It also provides an MCP server with screenshot, page-info, and PDF tools for AI agents.

See the ScreenshotNeo API documentation. This cURL request saves a WebP screenshot:

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

Python:

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)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo includes 1,000 screenshots a month free with no card; paid plans start at $5 for 3,000. Every feature is available on every plan. Sign up for free and get 1,000 screenshots a month with no card.

11. FAQ

Do I need to download ChromeDriver myself?

Usually not with Selenium 4.6 or newer if Selenium Manager can discover your browser and access the required driver data. Use a manual binary when you need explicit version or path control.

Does the Ubuntu Chromium snap work with Selenium?

It can, but discovery depends on your release and Selenium Manager version. Verify the executable path and browser version on the target machine.

Does being in India change the installation?

The official guidance used here does not identify an India-specific installation variation. Network access to download endpoints can still depend on the machine or organization.

Why does a working driver still produce no screenshot?

The driver only controls the browser. Browser launch, page readiness, rendering, and output permissions are separate conditions that must also succeed.