If Selenium screenshots work in Firefox but fail in Chrome, do not assume the screenshot method is the problem. First identify whether Chrome fails to start, the WebDriver screenshot command fails, or the image is captured but cannot be written to disk. Then verify the Chrome binary, ChromeDriver discovery and versions, launch mode, and output path separately.
The exact exception and your Selenium binding, Selenium version, Chrome version, ChromeDriver version, operating system, headed/headless setting, and local or remote runner determine the correct fix. The workflow below isolates each stage without treating any single cause as certain.
1. Identify exactly where the failure occurs
A WebDriver screenshot captures the current browsing context and returns image data (commonly Base64-encoded, depending on the binding). Selenium documents this as a browser operation, separate from saving the returned data to a file: Selenium window and tab documentation.
Run the test with logging and classify the result into one of these paths:
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →#1 Best Overall
- Session-start failure: Chrome never opens, navigation never completes, or WebDriver throws before the screenshot call.
- Capture failure: Chrome is open and the page is usable, but
get_screenshot_as_*or its equivalent throws, returns unusable data, or reports a protocol error. - File-write failure: capture succeeds, but the destination directory is missing, unwritable, relative to an unexpected working directory, or otherwise invalid.
Record the complete exception, not just its final line. Also record:
- Selenium language binding and version
- Chrome and ChromeDriver versions
- Operating system and CPU architecture
- Headed or headless mode and the exact launch arguments
- Local, remote, container, CI, or hosted test execution
- The Chrome executable and profile being used
Firefox succeeding only proves that your test logic can work with Firefox; it does not validate ChromeDriver installation, Chrome options, binary selection, or the Chrome runtime.
2. Verify ChromeDriver and browser setup
ChromeDriver is a separate executable that Selenium uses to control Chrome. Check that the intended Chrome installation exists and that the driver selected by this run is discoverable. Selenium’s driver-location guidance covers an explicit Service path and automated management such as Selenium Manager: Selenium driver-location troubleshooting.
Use Selenium Manager or an explicit Service path
With current Selenium releases, creating a Chrome driver normally lets Selenium Manager resolve a compatible driver when supported by your environment. If your organization pins binaries, pass the exact driver path through the binding’s Chrome Service object instead of relying on an accidental PATH entry. Make the choice explicit while diagnosing so you know which executable is running.
Recommended Free Tools
Do not copy an old ChromeDriver compatibility table. ChromeDriver documentation says releases from milestone 115 onward are published through the Chrome for Testing availability dashboard. Match the browser and driver using the current distribution guidance: What is ChromeDriver?.
Rank #2
Confirm the actual Chrome binary
Multiple Chrome or Chromium installations are common on developer machines, CI images, and containers. The binary Selenium launches may not be the one you checked manually. Set the Chrome option for the intended executable when necessary, then inspect the ChromeDriver log to confirm the path actually used.
ChromeDriver’s troubleshooting page recommends starting the same Chrome binary directly outside WebDriver. If direct launch fails, fix Chrome or its environment before investigating screenshots. If direct launch works from a terminal but fails under a test service, compare the service account, environment variables, permissions, profile directory, and sandbox/container restrictions: Chrome doesn’t start or crashes immediately.
Do not use --no-sandbox as a routine fix
ChromeDriver identifies running Chrome as root (administrator) on Linux as a common startup-crash cause. Its documentation says the --no-sandbox workaround is unsupported and highly discouraged. Prefer running Chrome as a non-root user and correcting the container or service account configuration.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
3. Prove that navigation works before capturing
Insert a short diagnostic checkpoint immediately before the screenshot:
- Start Chrome and print the session and browser capabilities.
- Navigate to a deterministic URL.
- Wait for the page condition your test needs (for example, a known element).
- Print the current URL and title.
- Capture the screenshot.
If the URL, title, or element wait fails, the screenshot error is downstream of startup, navigation, DNS, authentication, a certificate warning, a bot check, or a page timeout. Fix that earlier failure rather than changing screenshot APIs.
Rank #3
4. Use the standard screenshot call, then test the file write independently
Keep capture and persistence as two observable operations. In Python, get_screenshot_as_file() (also exposed as save_screenshot()) writes PNG output and returns False for an I/O failure according to the Chromium WebDriver API: Selenium Python Chromium WebDriver API.
Use an absolute path, create the directory first, and inspect the Boolean result. If the result is false while the browser command itself succeeds, investigate permissions and paths rather than ChromeDriver. The corresponding Firefox API is documented separately: Selenium Python Firefox WebDriver API.
Minimal Python diagnostic
from pathlib import Path
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
out = Path.cwd() / "artifacts" / "chrome.png"
out.parent.mkdir(parents=True, exist_ok=True)
options = Options()
# Enable only the mode you actually need while diagnosing.
# options.add_argument("--headless=new")
# options.binary_location = "/path/to/the/intended/chrome"
# If you manage the binary yourself, uncomment and set the path:
# service = Service("/path/to/chromedriver")
# driver = webdriver.Chrome(service=service, options=options)
driver = webdriver.Chrome(options=options)
try:
driver.get("https://example.com")
print("browser:", driver.capabilities.get("browserVersion"))
print("url:", driver.current_url)
print("title:", driver.title)
image_bytes = driver.get_screenshot_as_png()
print("captured bytes:", len(image_bytes))
ok = driver.save_screenshot(str(out))
print("save result:", ok, "path:", out)
if not ok or not out.is_file() or out.stat().st_size == 0:
raise OSError(f"Screenshot was not written: {out}")
finally:
driver.quit()
Use a temporary, known-writable directory first. Once this succeeds, reintroduce your normal profile, extensions, proxy, headless flags, custom window size, and test harness one change at a time.
5. Chrome-specific differences worth testing
Headed versus headless
Run the identical test once with a visible browser and once with your required headless setting. A failure in only one mode points to launch flags, display availability, GPU behavior, window sizing, or CI restrictions. Keep the mode that reproduces the problem while collecting logs; switching modes without recording the result hides the cause.
Profiles, extensions, and permissions
Use a fresh temporary Chrome profile for diagnosis. A locked or corrupted profile, extension, enterprise policy, download directory, or permission rule can prevent startup or alter the page before capture. If a clean profile works, add your production profile options back individually.
Rank #4
Local versus remote execution
A remote Selenium Grid or hosted service may run a different Chrome build, user, filesystem, and display environment. The path you pass to save_screenshot is on the machine running the browser, not necessarily your workstation. For remote sessions, capture the returned bytes and transfer them through your test’s artifact mechanism instead of assuming a local path exists.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsViewport and page state
Chrome can be displaying a blank, interstitial, login, or bot-check page even though the session is technically alive. Print the URL and title, save page source for diagnosis, and wait for a page-specific element. A screenshot command cannot make an incomplete navigation complete.
6. A repeatable diagnostic sequence
- Save the full exception and environment details listed in step 1.
- Run the same Chrome binary directly and confirm it starts under the same user.
- Confirm the ChromeDriver executable selected by Selenium and compare its version with the installed Chrome version using current Chrome for Testing guidance.
- Run a minimal test with a fresh profile and a simple URL.
- Test headed mode, then the required headless mode.
- Call the screenshot API and inspect returned bytes before writing a file.
- Write to an absolute path in a newly created directory and check the return value and file size.
- Reintroduce remote execution, custom options, profiles, proxies, and test-harness integration one at a time.
7. Common symptoms, causes, and fixes
| Symptom | Likely investigation area | Practical fix |
|---|---|---|
| “Unable to obtain driver” or driver-location error | ChromeDriver discovery or Selenium Manager | Use a supported Selenium version, verify Selenium Manager prerequisites, or pass an explicit Chrome Service path. |
| Chrome crashes before the screenshot call | Binary, profile, permissions, root execution, or incompatible driver | Launch the exact binary directly, use a clean profile and non-root account, inspect ChromeDriver logs, and align versions. |
| Works headed, fails headless | Headless flags, display/GPU, viewport, or CI policy | Compare modes with identical options, set a deliberate window size, and remove nonessential flags. |
| Screenshot call returns data but no file appears | Filesystem path or permissions | Use an absolute path, create the directory, check the Boolean return and file size, and remember remote paths belong to the browser host. |
| Blank or unexpected image | Navigation, authentication, consent, bot check, or timing | Print URL/title, wait for a page-specific element, and capture only after the intended state is present. |
Or skip the browser setup
If your goal is a reliable website image rather than diagnosing a local Chrome session, ScreenshotNeo provides a single screenshot API request. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers. It also offers an MCP server for AI agents such as Claude and Cursor.
See the parameter reference in the ScreenshotNeo documentation. cURL:
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 full-page and element capture, device presets or custom viewports, dark mode, retina scale, PDF output, custom CSS and JavaScript, click and wait actions, request/resource blocking, headers, cookies, user agents, authorization, timezone and geolocation, transparent backgrounds, resizing, configurable caching, signed links, asynchronous webhooks, bulk capture for up to 100 URLs per call, a usage API, and an OpenAPI specification. Existing screenshot-API parameter names also work to ease migration.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; yearly billing provides two months free, and every feature is available on every plan. Create a free ScreenshotNeo account.
Best Value
Performance, reliability, and cost considerations
- Capture only after the required page state is ready; unnecessary fixed delays increase test time.
- Keep browser profiles isolated in parallel jobs to avoid locks and cross-test state.
- Retain ChromeDriver logs and failed-page artifacts in CI so a later diagnosis can distinguish startup, navigation, capture, and writing failures.
- For repeated URL capture, caching can reduce repeated work; ScreenshotNeo lets you choose a cache TTL and reports whether a response was a cache hit.
- Do not measure reliability by screenshot file existence alone: validate HTTP/session success, image bytes, dimensions, and the page state represented by the image.
Frequently Asked Questions
Which exception should I share when asking for help?
Share the complete stack trace plus Selenium binding/version, Chrome and ChromeDriver versions, operating system, launch mode, local or remote environment, and the exact screenshot call.
Does a working Firefox screenshot prove my test is correct?
No. Firefox and Chrome use different drivers, binaries, options, profiles, and runtime environments, so Firefox success does not validate Chrome setup.
Should I switch to a different Selenium screenshot method first?
No. First determine whether Chrome starts, whether capture returns data, or whether only the file write fails; changing methods cannot repair a startup or environment problem.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallThe Bottom Line
Separate Chrome startup, screenshot capture, and file writing; verify the exact Chrome binary and driver, test the same environment directly, and use logs plus a minimal clean-profile script before restoring custom options.
Quick Recap
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.

