In Python, capture the current browser view with driver.save_screenshot("screenshot.png"). Run Chrome in headless mode, use a version-pinned Selenium container with enough shared memory, and make sure your CI system collects the file from the process that wrote it.
Capture a screenshot with Selenium
After creating a WebDriver session and navigating to a page, call save_screenshot() with a path writable by the Python test process. The method saves the current browsing context; it is not a general guarantee of a full-page capture. Selenium also provides an element screenshot method when you need an individual element instead.
As an Amazon Associate I earn from qualifying purchases.
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument("--headless=new")
driver = webdriver.Chrome(options=options)
try:
driver.get("https://example.com")
saved = driver.save_screenshot("screenshot.png")
if not saved:
raise RuntimeError("Selenium did not save the screenshot")
finally:
driver.quit()
Selenium’s Chrome documentation lists --headless=new among commonly used Chrome arguments and documents screenshot methods. Chrome’s headless documentation also shows the argument passed through Selenium Chrome options.
Run Chrome in a Selenium Docker container
The official selenium/standalone-chrome image runs a standalone Selenium Grid endpoint. Start it with port 4444 available to the test process and allocate shared memory:
#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
docker run --rm -p 4444:4444 --shm-size=2g
selenium/standalone-chrome:4.48.0-20260905
This tag is an example from the docker-selenium README, not a claim that it is the latest tag. Select and pin a full image tag suitable for your environment. Selenium recommends starting with --shm-size=2g to help address browser crashes, but says the right allocation depends on workload; tune it rather than treating 2 GB as a universal minimum.
Connect a Python test to the container
When Chrome runs in a separate container, the test process connects to its WebDriver endpoint. The screenshot bytes are returned through WebDriver and the binding writes the requested file path in the test process’s environment.
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
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument("--headless=new")
driver = webdriver.Remote(
command_executor="http://localhost:4444/wd/hub",
options=options,
)
try:
driver.get("https://example.com")
driver.save_screenshot("artifacts/screenshot.png")
finally:
driver.quit()
Create the artifacts directory before running this example, and ensure the test process can write to it. In CI, point artifact collection at that process-side path, not at a path inside the browser container. Validate the endpoint path and remote-session behavior against the Selenium version and deployment you actually use.
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 reinstallSet versions and capture dimensions deliberately
Selenium’s Chrome documentation says Selenium 4 is compatible with Chrome v75 and later, and that Chrome and ChromeDriver must match at the major-version level. Pin a full Selenium image tag so the browser and Grid versions are explicit; check the tag’s contents when upgrading rather than relying on an unpinned image name.
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.
For repeatable output, set the browser window size before navigation or capture, and keep it consistent across runs:
driver.set_window_size(1280, 900)
driver.get("https://example.com")
driver.save_screenshot("screenshot.png")
A viewport screenshot and a full-page screenshot are different requirements. Selenium’s cited examples establish current-context and element screenshots, not universal full-page behavior. Confirm the capture semantics of the method you choose if the whole document must fit in one image.
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
Choose between WebDriver and Chrome’s headless CLI
| Method | Best fit | Capture and output considerations |
|---|---|---|
| Selenium WebDriver | The page must be opened or interacted with through a WebDriver session. | Use driver.save_screenshot(path) for the current browsing context, or an element screenshot method for one element. The test process writes the result at the specified path. |
| Chrome headless CLI | The job only needs a browser command and does not need WebDriver interaction. | Chrome documents --screenshot with an explicit --window-size; this is a separate workflow and should not be assumed to behave identically to WebDriver. |
For example, Chrome documents this command-line form:
chrome --headless=new --screenshot --window-size=412,892 https://developer.chrome.com/
See Chrome’s headless documentation for the CLI workflow and options.
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.
Troubleshoot container screenshots
- Chrome exits or crashes: inspect the container’s
/dev/shmallocation. Selenium recommends--shm-size=2gas a starting workaround; adjust it to the workload. - The session will not start because of a version mismatch: compare Chrome and ChromeDriver major versions, then verify the full Selenium image tag and packaged browser version.
- Headless startup fails after an Xvfb change: consult the docker-selenium README for the exact image tag. Its version-sensitive guidance says newer Chrome/Chromium versions require
SE_START_XVFB=truefor--headless=newat v127+, and for--headlessat v132+. Confirm the guidance for your image instead of assuming headless and Xvfb settings are independent. - The screenshot is missing from CI artifacts: identify where the test process runs, check that the target directory exists and is writable, and configure the artifact collector to use that process-side path.
- The image has the wrong size or composition: set and record the viewport or window size, and check whether you need an element, viewport, or full-page capture.
Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server. One GET request can return a screenshot or PDF without running a browser container yourself. For example, save a WebP response with cURL:
curl -G "https://api.screenshotneo.com/v1/shot"
-d access_key=YOUR_API_KEY
--data-urlencode url=https://example.com
-o shot.webp
See the ScreenshotNeo documentation for request options and response details. Cookie and consent banners, newsletter popups, and chat widgets are removed before the shot; each cleanup step can be disabled. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents using Claude, Cursor, or another MCP client. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000.
Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month with no card.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →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.




