What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Use an absolute path to a .png file in a parent directory that already exists and is writable by the account running Python. Selenium’s save_screenshot() returns False when writing the screenshot encounters an I/O error, so check the return value and test the destination from the same process to find the cause.
What Selenium’s screenshot save result means
In Selenium’s Python WebDriver API, save_screenshot(filename) saves the current browser window as a PNG and delegates to get_screenshot_as_file(filename). The implementation gets the screenshot bytes, opens the requested path in binary write mode, and writes the bytes. It returns True on success and False if an OSError occurs while writing. Selenium recommends a full path and a .png extension. Selenium WebDriver API
As an Amazon Associate I earn from qualifying purchases.
A False result does not identify the specific filesystem problem. The destination may be relative to an unexpected working directory, its parent directory may not exist, or the Python process may lack access to the path. The correct diagnosis depends on the actual operating system, account, and filesystem.
Fix the destination path first
- Resolve an absolute path. Avoid relying on the current working directory, which can differ between a terminal, IDE, service, container, or CI runner.
- Create the parent directory if needed. Selenium writes the file but does not create missing parent directories. Python’s
Path.mkdir(parents=True, exist_ok=True)can create them. - Check the process identity. Verify which user runs Python in the environment where the failure occurs, and whether that account can write to the parent directory.
- Check the destination itself. Confirm the filename is not a directory and that neither the existing file nor its parent is inaccessible.
- Check Selenium’s Boolean result. Do not treat a call as successful unless it returns
True.
This example prints the resolved destination, creates its parent directory, and raises an error if Selenium reports that the write failed:
#1 Best Overall
- 14" diagonal, 1366x768 resolution, HD BrightView LED, Glossy NON-TOUCH Display
from pathlib import Path
from selenium import webdriver
output = Path("screenshots/homepage.png").resolve()
output.parent.mkdir(parents=True, exist_ok=True)
# Configure the driver for your browser and environment.
driver = webdriver.Chrome()
try:
driver.get("https://example.com")
print(f"Saving screenshot to: {output}")
if not driver.save_screenshot(str(output)):
raise OSError(f"Selenium could not write screenshot to {output}")
finally:
driver.quit()
Replace the example URL and configure the WebDriver for your environment. The directory creation step can create a directory tree, but it does not grant permissions to an account that lacks them. See Python’s pathlib documentation for path and directory operations.
Expose the underlying filesystem error
If save_screenshot() returns False, try an ordinary file write to the same path from the same Python process. That produces the filesystem exception, which is more informative than Selenium’s Boolean result:
from pathlib import Path
output = Path("screenshots/homepage.png").resolve()
output.parent.mkdir(parents=True, exist_ok=True)
try:
with output.open("wb") as file:
file.write(b"write test")
except OSError as exc:
print(f"Cannot write to {output}: {exc}")
raise
else:
output.unlink()
print(f"The process can write to {output.parent}")
Run this test in the same execution context as Selenium—not only in a separate interactive shell—because an IDE, service, container, or CI runner may use a different account or filesystem view. The test creates and then removes a small file; choose a destination where that is appropriate.
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #2
- 256 GB SSD of storage.
- Multitasking is easy with 16GB of RAM
- Equipped with a blazing fast Core i5 2.00 GHz processor.
Capture bytes separately from saving
When you need to separate browser capture from file storage, use get_screenshot_as_png(). It returns PNG bytes, which you can then write to a verified path or pass to another storage layer. The eventual destination still needs to be writable.
from pathlib import Path
from selenium import webdriver
output = Path("screenshots/homepage.png").resolve()
output.parent.mkdir(parents=True, exist_ok=True)
driver = webdriver.Chrome()
try:
driver.get("https://example.com")
png_bytes = driver.get_screenshot_as_png()
output.write_bytes(png_bytes)
finally:
driver.quit()
Selenium documents both screenshot methods in its Python WebDriver API.
Choose the saving method that fits
| Method | Use it when | Trade-off |
|---|---|---|
save_screenshot(path) |
The Python process can write directly to the destination. | Simple, but a write error is reported as False; check the result. |
get_screenshot_as_png() followed by storage |
You need to redirect, separate, or diagnose storage handling. | You receive bytes directly, but the eventual storage destination must still be writable. |
Common causes and recovery steps
- Relative path points somewhere unexpected: resolve and print the absolute path, then save there.
- Parent directory is missing: create it with
Path.mkdir(parents=True, exist_ok=True)before saving. - The process cannot write there: confirm the account running Python and choose a directory it can access, or adjust access according to your operating system and environment.
- The path names a directory rather than a file: use a filename ending in
.pnginside the intended directory. - An existing file or parent cannot be accessed: inspect the exact destination and its parent from the Python process context; behavior and error details vary by filesystem and operating system.
- Permission mode changes did not help: on POSIX systems, the process umask affects requested directory modes. Do not assume one permission number or command is a universal fix. Python pathlib documentation
Or skip the browser setup
ScreenshotNeo provides a website screenshot API and MCP server. One GET request can return an image or PDF; the capture options include PNG, JPEG, or WebP. For an image capture, here is a cURL example: ScreenshotNeo API documentation.
Rank #3
- WINDOWS 11 | STABLE PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 system, this laptop delivers stable performance for everyday computing tasks. It supports web browsing, online learning, document editing, email communication, and basic office work with optimized power efficiency, providing a practical and reliable experience for essential daily use for daily use.
- 15.6” FHD IPS DISPLAY: Features a 15.6-inch Full HD IPS display with narrow bezels, offering wider viewing angles and clearer image details compared to standard panels. The improved screen-to-body ratio enhances visual experience for study, reading, document work, and video playback, making it suitable for both productivity and entertainment use.
- 4GB DDR4 + 128GB eMMC STORAGE: Equipped with 4GB DDR4 memory and 128GB eMMC storage for everyday basics such as browsing, documents, email, and online learning platforms. The built-in TF card slot supports storage expansion up to 1TB, giving you more flexibility for files, photos, videos, and daily documents. TF card not included.
- CONNECTIVITY & PORTS: Includes 1× TF card slot, 2× USB 3.2 Gen1 ports, and 2× full-featured Type-C ports (USB 3.2 Gen1). The Type-C ports support data transfer, charging, and video output, enabling flexible connection with external devices such as monitors, storage, and peripherals for daily work and study use.
- LIGHTWEIGHT DESIGN | ONLINE COMMUNICATION: Designed with a slim, portable profile, this laptop is easy to carry for school, commuting, and travel. A built-in 1MP front camera supports online classes, video meetings, remote communication, and everyday conferencing. The 3300mAh battery works with the low-power system design to support practical daily use, while thermal optimization helps maintain quieter operation during extended tasks.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
ScreenshotNeo accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers indicate the page verdict and billing status. Its MCP server includes take_screenshot, get_page_info, and capture_pdf for AI agents. The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsSign up for ScreenshotNeo and start with 1,000 free screenshots a month, no card required.
Frequently Asked Questions
Why does Selenium return False instead of showing a permission error?
The Python screenshot-saving method catches an OSError from the file write and reports failure with a Boolean False. Test a normal write to the same resolved path in the same process context to reveal the filesystem exception.
Does save_screenshot create the screenshots directory?
No. Create the parent directory before calling the method; for example, use Path.mkdir(parents=True, exist_ok=True).
Does get_screenshot_as_png() avoid file permissions?
It avoids Selenium’s direct file write by returning screenshot bytes, but saving those bytes to a file still requires write access to the destination.
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.




