A black screenshot from Selenium-controlled Chrome does not point to one universal bug. Start by checking that Chrome and ChromeDriver have matching major versions, set headless mode and viewport deliberately, and verify the active window and page at capture time. Then compare headless and headful runs under the same conditions. Those checks narrow the problem; none is a guaranteed fix.
Start with the browser and driver versions
Before changing image handling or adding workarounds, record your Selenium, Chrome, and ChromeDriver versions. Selenium’s Chrome documentation says Chrome and ChromeDriver must match at the major-version level: Selenium: Chrome specific functionality.
Also record the exact Chrome arguments passed by your test. That makes it possible to reproduce the startup configuration rather than guessing which mode or flags were active.
Set headless mode and the viewport explicitly
For Selenium 4, Chrome’s commonly used arguments include --headless=new. Make the viewport explicit as well, so repeated captures use controlled dimensions. For example:
Recommended Free Tools
#1 Best Overall
- CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
- WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
- A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
public class HeadlessScreenshot {
public static void main(String[] args) throws Exception {
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless=new");
options.addArguments("--window-size=1920,1080");
WebDriver driver = new ChromeDriver(options);
try {
driver.get("https://example.com");
File image = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
Files.copy(image.toPath(), Path.of("shot.png"));
System.out.println("Saved screenshot to shot.png");
} finally {
driver.quit();
}
}
}
This is a controlled starting configuration, not a fix guaranteed to resolve every black image. Use a headless argument supported by the Chrome version installed in your environment; check Selenium’s current Chrome guidance and Chrome’s Headless mode documentation if behavior differs. Chrome documents that, starting with version 132.0.6793.0, old Headless is available only as the separate chrome-headless-shell binary.
Chrome’s command-line reference recommends combining screenshot capture with --window-size when using its screenshot option. That supports controlling dimensions during diagnosis; it does not establish that a particular size cures black pixels. See Chrome Headless command-line reference.
Rank #2
- CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
- SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
Confirm Selenium is capturing the intended page and window
A WebDriver screenshot captures the current browsing context. Before calling getScreenshotAs, verify the driver is on the expected URL and window, especially if the test opened a new tab, switched windows, or navigated to a browser-generated page. Selenium’s Java screenshot example and browsing-context explanation are in Working with windows and tabs.
For a reproducible check, log the current URL, window handle, and screenshot dimensions alongside the test result. Compare captures taken at repeatable points in the page lifecycle. If delaying capture changes the image, investigate the application’s loading and rendering behavior; timing is something to test, not a confirmed cause of this symptom.
Rank #3
- Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
- Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
- Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
- In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
- Ultra-thin bezels: Maximize your viewing experience with thin bezels.
Compare headless and headful runs
Run the same test with the same Chrome and ChromeDriver versions, page, steps, and viewport, changing only whether Chrome is headless. If headful works and headless does not, that narrows the investigation but does not identify the cause by itself. Chrome says current Headless shares code with Chrome and that Headless and headful modes are unified; do not assume black output automatically means a separate rendering engine is responsible. See Chrome Headless mode.
Troubleshoot in a controlled order
- Check major-version compatibility. Record Chrome and ChromeDriver versions and confirm their major versions match.
- Record the actual startup arguments. Confirm the intended headless argument reached Chrome, and use the option appropriate to the installed version.
- Fix the viewport for the test. Set a known window size and inspect the resulting PNG dimensions.
- Verify the capture context. Log the URL and selected window handle immediately before capture; ensure the test has not switched to a different tab or browser page.
- Repeat at a consistent point. Capture using the same page state and test steps. If timing appears relevant, vary it deliberately and compare outputs rather than assuming a delay is the remedy.
- Compare headful mode. Keep versions, page, steps, and viewport constant and vary only headless versus headful mode.
- Inspect the PNG independently. Open the saved file outside the test runner and record its dimensions. This distinguishes a genuinely black image from a display or reporting issue in the test environment.
Common symptoms and next checks
| Observation | What to check next |
|---|---|
| Chrome and ChromeDriver have different major versions | Use a compatible pair, then rerun the same capture before investigating other variables. |
| The screenshot has unexpected dimensions | Set an explicit window size and check the saved PNG dimensions against the expected viewport. |
| The image shows the wrong page or a browser page | Check the current URL and active window handle at capture time; switch to the intended window before taking the screenshot. |
| Headful works, headless remains black | Keep the test inputs fixed and collect the environment details below. The mode difference narrows the problem but does not prove a particular defect. |
| The image is still black after these checks | Prepare a minimal reproduction with exact versions, options, page, environment, and image dimensions. The available documentation does not establish one universal fix for this symptom. |
What to include in a useful reproduction
- Selenium, Chrome, and ChromeDriver versions.
- Operating system and whether the test runs in a container or CI environment.
- The exact ChromeOptions arguments and configured viewport.
- The page URL, redacted if needed, and whether it is a normal page or a browser/error page.
- The selected window handle and current URL at capture time.
- The saved image’s dimensions and whether it appears black when opened independently.
- Whether an otherwise identical headful run produces the same result.
Or skip the browser setup
If you need a screenshot without configuring a local Selenium browser, ScreenshotNeo provides a screenshot API and MCP server. A single GET request can return an image or PDF. For example, the cURL request below saves a WebP screenshot; see the ScreenshotNeo API documentation for options and setup.
Quick Recap
Best Value
- 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
- 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
- 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
Rank #4
- CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
- SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
- MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
- KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
- INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each of those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. Its MCP server offers take_screenshot, get_page_info, and capture_pdf for AI agents and other MCP clients. The free plan includes 1,000 screenshots per month with no card required; paid plans start at $5 for 3,000. Sign up for free.
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.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problems




