Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
If an ExtentReports screenshot is missing or appears as a broken image, first check whether the image file exists and whether the report’s HTML points to its actual location. File-based screenshots are linked from the generated report rather than embedded automatically, so moving the report, deleting a CI workspace, or using the wrong attachment API can break the image. For a screenshot attached to a failure log, use a media entity; if the report and image cannot reliably travel together, use a Base64 attachment.
Why is my screenshot missing from ExtentReports?
There are two separate jobs: capture the screenshot, then attach it to the report. A successful capture does not guarantee that the report can display the image. With file-based attachments, the report contains an image reference, commonly an HTML <img> element, and the image file must remain available at the referenced path when the report is opened.
- The capture failed: the file was never created, is empty, or cannot be read.
- The reference is wrong: the HTML points to a path that does not resolve from the report’s location.
- The attachment API does not match the report location: a log or failure event needs a media entity, not just a test-level screenshot call.
- The artifact was moved or removed: the report was copied without its image directory, or CI cleaned up the workspace.
- The report was finalized too early: attachment logging happened after report finalization, or the report was not flushed after logging.
Start with the generated report, not assumptions about the browser. Inspect the image reference in the HTML and verify that its target exists.
Windows 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 reinstallOutdated 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 matchHow do I verify the screenshot file and report path?
- Check immediately after capture. Log the absolute path, file size, and whether the file is readable. Open the image independently. If it is absent or unreadable, fix the capture or file-writing step before changing ExtentReports code.
- Find the image reference in the HTML. Search the generated report for the screenshot filename or an
<img>tag. Note the value of itssrcattribute. - Resolve the reference from the report directory. For a relative path, join it to the directory containing the report and check that the resulting file exists. An absolute path may work on the machine that generated the report but fail after the report is moved to another machine.
- Open the report with its images in place. Package the report and referenced image directory together, keeping their relative layout intact. If the report is published as a build artifact, include the image files as well.
- Attach before finalizing. Log the screenshot while the test and report are still active, then flush the report after logging.
A useful stable layout is one output root containing both the HTML report and a screenshot directory. Set or construct each reference relative to the report file, not relative to an unpredictable current working directory.
#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
How do I attach a screenshot to an ExtentReports failure?
Choose the method based on where the screenshot should appear. A test-level image and an image attached to a particular log or failure event are not interchangeable.
Attach an image to the test
For a test-level capture from a file path, use:
test.addScreenCaptureFromPath(path);
The file at path must exist, and the report must be able to resolve its reference later. The API also has a title overload; use it if a label helps distinguish multiple captures.
Attach an image to a failure log
For an image associated with a log or failure event, create a media entity and pass it to the log call:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
test.fail("details",
MediaEntityBuilder.createScreenCaptureFromPath(path).build());
This distinction is a common fix for a missing screenshot in ExtentReports: calling only addScreenCaptureFromPath adds a test-level capture, but it does not create the media entity for the failure log. The file-path media API also supports a title overload.
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
Minimal Java example of the attachment calls
This fragment shows the relevant attachment calls; test is your existing ExtentReports test node and path is the screenshot file’s path. Keep the actual driver capture and reporter setup appropriate to your project’s installed ExtentReports version.
import com.aventstack.extentreports.MediaEntityBuilder;
import java.nio.file.Files;
import java.nio.file.Path;
Path screenshot = Path.of("target", "screenshots", "failure.png");
if (!Files.isReadable(screenshot) || Files.size(screenshot) == 0) {
throw new IllegalStateException("Screenshot is missing or empty: "
+ screenshot.toAbsolutePath());
}
String path = screenshot.toAbsolutePath().toString();
test.addScreenCaptureFromPath(path);
test.fail("Failure details",
MediaEntityBuilder.createScreenCaptureFromPath(path).build());
Use the test-level call or the failure-log call according to where you want the image displayed; the example shows both alternatives, not a requirement to attach the same image twice. If portability is important, prefer a stable relative path and ship its directory with the report rather than relying on a machine-specific absolute path.
When should I use Base64 instead of a file path?
Base64 stores the image data in the report attachment rather than depending on a separately located image file. It is useful when reports are uploaded independently, CI removes its workspace, or a report is routinely moved between machines. ExtentReports documents Base64 forms for both test-level screenshots and log media:
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →test.addScreenCaptureFromBase64String(base64Image);
// For a log or failure event:
test.fail("details",
MediaEntityBuilder.createScreenCaptureFromBase64String(base64Image).build());
Use valid Base64 image data, not a file path. Embedding removes the external-file dependency but increases the report payload and can use more memory. It cannot repair a failed browser capture or invalid image bytes, so verify the image before encoding it.
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.
Why does the report show a broken image icon?
A broken image icon usually means the browser could not load the image named by the report’s src. Check these causes in order:
- Wrong relative base: the file exists, but not relative to the directory where the report HTML sits. Correct the relative reference or move the image directory alongside the report.
- Absolute path from another machine: the report refers to a developer workstation or a CI worker path. Replace it with a portable relative path and package the directory, or embed the image as Base64.
- Filename or case mismatch: check the actual filename and capitalization. CI systems may use a case-sensitive filesystem even if a local machine does not.
- Missing artifact: the report was retained but the screenshot directory was excluded from artifact upload or removed during cleanup. Publish them together.
- Empty or invalid image: confirm the file opens as an image and has nonzero size before attaching it.
- Wrong attachment location: if the image should accompany a failure log, attach a media entity to that log rather than relying only on a test-level attachment.
Why do screenshots work locally but not in CI?
Local runs often leave screenshots in a stable workspace that remains available while a developer opens the report. CI may use a temporary checkout directory, a different working directory, a separate artifact upload step, or workspace cleanup. The HTML can therefore be valid on the worker and broken after publication.
Use a predictable output root
Write the report and screenshot directory beneath one known build output directory. Create the screenshot directory before capture and use a path relative to the report location. Avoid constructing paths from an assumed current working directory unless the build explicitly controls it.
Publish the complete artifact
Configure the CI artifact step to retain both the report and its referenced screenshots. Preserve directory structure when downloading or publishing artifacts; flattening files or uploading only the HTML can invalidate relative paths.
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
Use Base64 if separate artifact paths cannot be preserved
If policy or cleanup means the report cannot travel with external image files, embed the image with the Base64 test or log API. Account for the larger HTML payload, especially when attaching many or large screenshots.
Keep attachment and report lifecycle in order
Attach screenshots before the relevant test/report is finalized. After logging, flush the report so the generated HTML includes the attachment. If the report is created or flushed in a shared teardown, check that all test logging has completed before that point.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Which ExtentReports version and reporter are you using?
Confirm the installed major version before copying setup examples. ExtentReports 4 and 5 use related screenshot concepts, but reporter setup differs: the documented version 5 Java example uses ExtentSparkReporter, while version 4 examples use the earlier versioned API patterns. Keep imports and reporter initialization consistent with the dependency actually installed in the project.
The upstream changelog records historical fixes relating to missing embedded screenshots and an HTML reporter issue involving an empty image path. That history is a reason to verify the generated HTML and confirm the project’s version when behavior is unexpected; it is not proof that a current failure has the same cause.
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.
The code here uses Java method casing. In the .NET guide, corresponding names use PascalCase, such as AddScreenCaptureFromPath and MediaEntityBuilder.CreateScreenCaptureFromPath. If you use a Cucumber adapter or another binding, check that adapter’s screenshot output directory and relative-path behavior rather than assuming the Java setup applies unchanged.
CI artifact checklist
- Capture: confirm the image is created, readable, nonempty, and opens independently.
- Attach: use the test-level API for a test capture or a media entity for a failure/log capture.
- Locate: inspect the report’s image
srcand resolve it from the report file’s directory. - Package: retain the report and image directory together with their directory structure intact.
- Order: attach before finalization and flush after logging.
- Portability: use relative paths for packaged files, or Base64 when external image files cannot travel with the report.
- Version: check dependency version, reporter setup, imports, and adapter-specific path handling.
Or skip the browser setup
If you need a website screenshot as an input image, ScreenshotNeo can return a screenshot from one GET request. Save the response as an image file, then attach that file to ExtentReports using the path-based calls above. This is a way to obtain a website capture; it does not replace the ExtentReports attachment step.
For example, retrieve a PNG for a URL and save it locally:
Free tools Windows power users keep installed
One-click scans. No signup required.
curl -G "https://api.screenshotneo.com/v1/shot"
-d access_key=YOUR_API_KEY
--data-urlencode url=https://stripe.com
-o shot.png
See the ScreenshotNeo documentation for request options. Cookie banners, popups, and chat widgets are removed before the shot; bot checks, blank pages, and failed loads are never billed. An MCP server lets AI agents take screenshots, and 1,000 screenshots per month are free with no card; paid plans start at $5 for 3,000. Sign up for ScreenshotNeo’s free plan.
Frequently Asked Questions
Does addScreenCaptureFromPath attach an image to a failure log?
No. For a failure or log event, create a media entity with MediaEntityBuilder.createScreenCaptureFromPath(path).build() and pass it to the log call.
Can I keep screenshot files outside the report folder?
Yes, if the HTML reference resolves correctly and the report is distributed with the referenced files. Preserve the relative layout when packaging the artifact.
Does Base64 fix a screenshot that was never captured?
No. Base64 changes how valid image data is stored; first confirm that capture produced readable image bytes.
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.

