Give every test execution its own screenshot path. If parallel workers all save to screenshot.png, they can overwrite or race over the same file; separate WebDriver sessions do not make that shared filename unique. Use a run ID, test name, worker or shard ID, and retry attempt to build a distinct destination, then check that the screenshot was saved successfully.
Why parallel screenshots conflict
Selenium captures the current browsing context, and the test code supplies the destination for the screenshot. When two executions write to the same destination, ordinary filesystem behavior creates a collision risk: one file may replace another, or the resulting artifact may not be the one you expected. Selenium does not prescribe a filename convention; unique naming is a responsibility of the test harness.
As an Amazon Associate I earn from qualifying purchases.
Keep browser-session isolation and artifact isolation separate in your design. Give parallel tests their own WebDriver sessions where appropriate, but also give each execution a distinct screenshot destination.
Build a unique path for every execution
A useful path combines the CI run or build ID, a sanitized test or scenario identifier, and worker or shard and retry identifiers. For example:
#1 Best Overall
- KEYBOARD: The keyboard works for Windows with hot keys that enable easy access to Media, My Computer, Mute, Volume up/down, and Calculator
- EASY SETUP: Experience simple installation with the USB wired connection
- VERSATILE COMPATIBILITY: This keyboard is designed to work with multiple Windows versions, including Vista, 7, 8, 10 offering broad compatibility across devices.
- SLEEK DESIGN: The elegant black color of the wired keyboard complements your tech and decor, adding a stylish and cohesive look to any setup without sacrificing function.
- FULL-SIZED CONVENIENCE: The standard QWERTY layout of this keyboard set offers a familiar typing experience, ideal for both professional tasks and personal use.
screenshots/run-4812/test-checkout-worker-3-attempt-1.png
Prefer stable identifiers supplied by your test runner or CI environment to a timestamp alone. Sanitize names before using them as path components: test names can contain slashes, spaces, or other characters that are unsuitable in a filename. Create the parent directory before saving, and treat a failed save as a test-artifact error rather than assuming the file exists.
Rank #2
- Reliable Plug and Play: The USB receiver provides a reliable wireless connection up to 33 ft (1), so you can forget about drop-outs and delays and you can take it wherever you use your computer
- Type in Comfort: The design of this keyboard creates a comfortable typing experience thanks to the low-profile, quiet keys and standard layout with full-size F-keys, number pad, and arrow keys
- Durable and Resilient: This full-size wireless keyboard features a spill-resistant design (2), durable keys and sturdy tilt legs with adjustable height
- Long Battery Life: MK270 combo features a 36-month keyboard and 12-month mouse battery life (3), along with on/off switches allowing you to go months without the hassle of changing batteries
- Easy to Use: This wireless keyboard and mouse combo features 8 multimedia hotkeys for instant access to the Internet, email, play/pause, and volume so you can easily check out your favorite sites
Python example: save and check the result
Selenium’s Python API provides save_screenshot(filename) and get_screenshot_as_file(filename); the documented file-saving API returns a Boolean success result. The following helper takes its identifiers from the caller, sanitizes the test name, creates the run directory, and checks the return value.
Recommended Free Tools
from pathlib import Path
import re
def safe_component(value: str) -> str:
cleaned = re.sub(r"[^A-Za-z0-9._-]+", "-", value).strip(".-_")
return cleaned or "unnamed"
def save_test_screenshot(driver, run_id, test_id, worker_id, attempt):
run_dir = Path("screenshots") / safe_component(run_id)
run_dir.mkdir(parents=True, exist_ok=True)
filename = (
f"{safe_component(test_id)}-"
f"{safe_component(worker_id)}-"
f"attempt-{safe_component(str(attempt))}.png"
)
path = run_dir / filename
saved = driver.save_screenshot(str(path))
if not saved:
raise OSError(f"Selenium could not save screenshot to {path}")
return path
# Call this from each test using identifiers from your runner or CI:
# path = save_test_screenshot(driver, "build-4812", "checkout-test", "worker-3", 1)
# print(f"Screenshot saved to {path}")
Supply identifiers that are unique within the run. If retries can execute concurrently, the attempt value must distinguish them; if your runner can schedule the same test more than once within one worker and attempt, include another unique execution ID. Do not share a fixed filename between tests.
Rank #3
- All-day Comfort: The design of this standard keyboard creates a comfortable typing experience thanks to the deep-profile keys and full-size standard layout with F-keys and number pad
- Easy to Set-up and Use: Set-up couldn't be easier, you simply plug in this corded keyboard via USB on your desktop or laptop and start using right away without any software installation
- Compatibility: This full-size keyboard is compatible with Windows 7, 8, 10 or later, plus it's a reliable and durable partner for your desk at home, or at work
- Spill-proof: This durable keyboard features a spill-resistant design (1), anti-fade keys and sturdy tilt legs with adjustable height, meaning this keyboard is built to last
- Plastic parts in K120 include 51% certified post-consumer recycled plastic*
Choose how screenshot data reaches artifact storage
There are two common approaches. The right one depends on the Selenium binding, where the browser runs, and how CI collects artifacts.
| Approach | When it fits | What to verify |
|---|---|---|
| Save directly to a unique path | The process saving the screenshot can write to the chosen directory, and CI can collect that directory. | Build the path from per-execution identifiers, create the directory, and check the save result. |
| Get screenshot data and write or upload it in test code | You need to transfer screenshot bytes or encoded data to a separate artifact store or another destination. | Check the binding’s return format and ensure the code that receives the data can reach the destination. Selenium’s WebDriver screenshot endpoint returns screenshot data encoded in Base64. |
Selenium’s official examples show both saving to a caller-selected path and working with screenshot data. The available methods and return format vary by language binding; follow that binding’s API rather than assuming Python behavior applies elsewhere.
Rank #4
- 【Dreamy Rainbow Gaming Keyboard】K521 Gaming Keyboard Adopts a Different LED Backlight Design, Upgraded on the Traditional LED Backlight Effect, Making the Light More Penetrating, Giving You a More Dazzling Visual Effect, Making Your Gaming Process More Enjoyable
- 【One Touch Opens & Visual Feast】The K521 Red Dragon Keyboard has a One-Touch on/off Lighting Button for Added Convenience. It also has a Three-Position Adjustable Breathing Mode and a Four-Position Adjustable Brightness Lighting Mode
- 【Mechanical Feeling & Fast Tapping】The PC Keyboard Keys are Designed for Mechanical Feeling, Giving You a Better Feel During Use and the Ability to Trigger Keys Quickly, Allowing You to Win All Your Games
- 【19 Keys Anti-Ghosting Keyboard】Anti-Ghosting Ensures Every Button Can Be Triggered. This Allows You to Trigger Key Combinations In The Game Accurately, And Each Skill Can Be Accurately Released to Increase Your Winning Rate. Redragon K521 Will Be Your Perfect Partner
- 【12 Multimedia Combination Keys】The K521 Wired Gaming Keyboard is Equipped with 12 Multimedia Keys That Can Greatly Enhance Your Gaming/Office Efficiency and Make It More Convenient to Use
What changes with Selenium Grid
Selenium Grid routes WebDriver scripts to remote browser instances and supports parallel execution across machines. Grid determines where browser sessions execute; it does not establish a naming policy for your screenshot files. Your test code or artifact pipeline still needs to prevent collisions.
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 →For a Grid run, determine where the screenshot is materialized: the test process, a remote endpoint, or another provider-managed location. Then confirm that the process saving it can access the selected path, or transfer the returned screenshot data to storage the CI system can collect. The exact behavior depends on the language binding, remote endpoint, and artifact arrangement, so verify it in your own setup.
Best Value
- All-day Comfort: This USB keyboard creates a comfortable and familiar typing experience thanks to the deep-profile keys and standard full-size layout with all F-keys, number pad and arrow keys
- Built to Last: The spill-proof (2) design and durable print characters keep you on track for years to come despite any on-the-job mishaps; it’s a reliable partner for your desk at home, or at work
- Long-lasting Battery Life: A 24-month battery life (4) means you can go for 2 years without the hassle of changing batteries of your wireless full-size keyboard
- Simply plug the USB receiver into a USB port on your desktop, laptop or netbook computer and start using the keyboard right away without any software installation
- Simply Wireless: Forget about drop-outs and delays thanks to a strong, reliable wireless connection with up to 33 ft range (5); K270 is compatible with Windows 7, 8, 10 or later
Grid capacity also depends on deployment resources. Selenium’s getting-started guidance treats its resource examples as reference points and recommends measuring performance in the target environment, not treating an example session count as a universal limit.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshooting screenshot artifacts
- One test’s image replaces another: Find any fixed output name shared by workers. Add run, test, worker or shard, and attempt identifiers to the destination.
- A screenshot is missing: Create the parent directory before saving and check the save method’s result. Confirm that the saving process has write access to the destination.
- The image is saved, but CI does not show it: Check which machine or process wrote the file and whether the CI artifact collector includes that location. In Grid setups, verify the actual screenshot transfer path rather than assuming the browser node and test runner share a filesystem.
- Two retries still collide: Include a retry or execution identifier in addition to the test name and worker. Ensure that concurrently running retries cannot produce the same complete path.
- The filename contains invalid characters or creates nested folders: Sanitize test and run identifiers before using them as path components; replace unsupported characters and strip path separators.
- Grid runs slowly or queues sessions: Check available deployment resources and measure session throughput in the target environment. Selenium’s Grid guidance does not make one capacity figure applicable to every machine or deployment.
Or skip the browser setup
If you need a screenshot of a URL rather than an image from the browser session already controlled by Selenium, ScreenshotNeo is a website screenshot API. A single request can return an image or PDF; it complements rather than changes the session and artifact choices in a Selenium test. Its API accepts a URL and can return PNG, JPEG, WebP, or PDF. The request below saves a WebP capture; see the ScreenshotNeo API documentation for request options.
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 or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and the response says which outcome occurred. It also has an MCP server with take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients. The Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots.
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 reinstallSign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month without a card.
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.




