Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk6 min

How to Fix Selenium Headless Chrome Screenshots Failing on an Ubuntu Server

A diagnostic path for missing, blank, or incorrect Selenium headless Chrome screenshots on Ubuntu, from driver discovery and version checks to capture timing and output paths.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Most Selenium screenshot failures on Ubuntu start before the screenshot step: the driver is missing or mismatched, Chrome cannot start under the job’s account, or the page is captured before it is ready. Diagnose the failure stage first, then check the browser and driver versions, launch configuration, rendering, and output file. The server being in India is not, by itself, an established cause; the available official documentation does not identify a location-specific issue.

First identify where the failure occurs

Before changing packages or adding Chrome flags, record enough detail to reproduce the job. A missing screenshot, a browser that will not launch, a blank image, and an image with the wrong dimensions point to different parts of the pipeline.

As an Amazon Associate I earn from qualifying purchases.

  • Ubuntu release and architecture.
  • Selenium version, Chrome or Chromium binary path and version, and ChromeDriver path and version.
  • The exact Chrome arguments and the command or script that starts the job.
  • The operating-system account running the job, including whether it is root.
  • The full Selenium exception, ChromeDriver log, and any Chrome startup output.
  • Whether the output is absent, blank, clipped, or simply captured too early.

Selenium requires a browser driver executable to be available to the session. If the error says the driver cannot be found, fix driver discovery before investigating rendering. See Selenium’s Unable to Locate Driver Error.

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

Check that Chrome and ChromeDriver can work together

Record both version strings, not just the package names. Selenium’s Chrome guidance says Chrome and ChromeDriver must have matching major versions; align those major versions before debugging screenshot behavior. Selenium 4 supports Chrome v75 and later according to the same guide, but that does not mean every ChromeDriver build works with every Chrome build. See Selenium’s Chrome-specific functionality guide.

If Chrome updates independently of ChromeDriver, a previously working job can begin failing at session creation. Re-check both installed versions after an update, and make sure Selenium is launching the binary whose version you inspected—not a second Chrome or Chromium installation elsewhere on the server.

Reproduce Chrome startup outside Selenium

Use the same browser binary, arguments, environment, and operating-system account as the failing job. ChromeDriver’s troubleshooting guidance recommends verifying the browser binary and checking its log when Chrome does not launch. If Chrome cannot start directly with that setup, fix the installation or launch configuration before changing Selenium’s screenshot code. See Chrome doesn’t start or crashes immediately.

Do not run the browser as root as a routine fix

Chrome for Developers identifies running Chrome as root on Linux as a common startup-crash cause. Run the browser under a regular, non-root user where possible. The same guidance says the --no-sandbox workaround is unsupported and highly discouraged; it should not be treated as a standard repair or added simply to suppress a startup error.

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

Confirm the Headless mode matches your Chrome version

Chrome’s Headless implementation changed: Chrome 112 unified Headless and headful implementations, and from Chrome 132 the old Headless implementation is available only as the separate chrome-headless-shell binary. Verify the actual browser binary and mode used by the service before applying instructions written for an older Chrome generation. Chrome’s documented Selenium example enables Headless by adding --headless to Chrome options. See Chrome Headless mode.

For example, a Selenium 4 Python session can specify the installed binary and headless argument explicitly:

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

options = Options()
options.binary_location = "/usr/bin/google-chrome"
options.add_argument("--headless")
options.add_argument("--window-size=1440,1000")

driver = webdriver.Chrome(options=options)
try:
    driver.get("https://example.com")
    driver.save_screenshot("shot.png")
finally:
    driver.quit()

Replace the binary path with the path actually installed on the server. This example does not add --no-sandbox; run Chrome as a regular user rather than relying on that discouraged workaround.

Separate page readiness from screenshot capture

A session can start and navigate successfully while still capturing an incomplete page. Inspect the working directory and verify the file was written; then check whether it is blank, clipped, or dimensioned differently from the intended viewport. Chrome’s command-line documentation describes --screenshot, --window-size, and --timeout; the CLI screenshot is written to the current working directory, while the timeout limits how long Chrome waits before capturing even if the page is still loading. These CLI options explain the browser’s behavior, but Chrome’s CLI timeout is not a Selenium wait setting. See Chrome Headless command-line reference.

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

In Selenium, set the viewport deliberately and wait for the page condition that matters to your application, such as a particular element becoming visible. Do not assume that navigation returning means every image, script, or client-rendered component is ready. Use an explicit output path if the job runs with a different working directory than your interactive shell.

Use logs and remote inspection for rendering problems

If Chrome starts but the result is still wrong, inspect the ChromeDriver log and the live target rather than changing flags at random. Chrome’s Headless documentation describes remote debugging as a way to inspect a running target. That can help distinguish navigation or page-rendering symptoms from a screenshot-write problem, but the debugging session still needs to be examined to establish the cause.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot by symptom

Symptom Likely area to check Next action
Driver-location or executable error Driver discovery Confirm the driver executable is installed and discoverable by the Selenium process; check the configured path and permissions.
Session creation fails or Chrome exits immediately Version compatibility, binary path, launch account, or Chrome startup Compare Chrome and ChromeDriver major versions, reproduce launch under the same account and arguments, and inspect ChromeDriver logs.
Chrome crashes when the scheduled job runs Execution account or environment Check whether the job runs as root and switch to a regular user where possible. Do not make --no-sandbox the routine remedy.
Screenshot file is missing Working directory or write permissions Check the process working directory, output path, and permissions for the job’s user; confirm the capture call completed.
Image is blank or incomplete Navigation and page readiness Wait for the application-specific element or state needed for capture, then inspect the rendered target through logs or remote debugging.
Image is clipped or has unexpected dimensions Viewport and capture configuration Set and verify the intended viewport dimensions, then compare the resulting image dimensions with the target.
Advice using an old Headless flag or binary does not work Chrome generation and Headless implementation Check the installed Chrome version and whether the job invokes Chrome or the separate chrome-headless-shell binary.

Or skip the browser setup

If your goal is a screenshot rather than managing Chrome and ChromeDriver on the server, ScreenshotNeo returns an image or PDF from one GET request. Its API accepts a URL and supports PNG, JPEG, WebP, or PDF output. For example, this cURL call saves a WebP screenshot; create an API key first and replace the target URL as needed. See the ScreenshotNeo API documentation for request options and response details.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
  • It accepts cookie or consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off.
  • Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed; response headers report the page verdict and billing status.
  • An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients.
  • The free plan includes 1,000 shots a month with no card; paid plans start at $5 for 3,000 shots.

Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month without a card.

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

Frequently Asked Questions

Does running the server in India cause Selenium screenshots to fail?

The official Chrome and Selenium guidance cited here does not establish an India-specific cause. If the symptom is tied to network access or a regional policy, investigate that separately.

Should I add –no-sandbox to make Chrome start?

Chrome for Developers describes that workaround as unsupported and highly discouraged. Prefer running Chrome as a regular, non-root user and correcting the actual launch setup.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.