Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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 captureScreenshotOnFailure does nothing, first check which Selenium test class your test extends. The setting belongs to the legacy PHPUnit Selenium RC flow, PHPUnit_Extensions_SeleniumTestCase; a historical Selenium2 report says it is not available on PHPUnit_Extensions_Selenium2TestCase. If you are using the legacy class, check the exact property names and whether the failure is an assertion failure. In the original PHPUnit 3.4.12 report, a misspelled $screenshotUrl and a call to Selenium’s fail() were relevant to the missing capture; a failed assertion did trigger one. These are findings from a particular historical setup, not guarantees for every version.

First identify which Selenium test class you are using

Do not start by changing the screenshot directory or copying a configuration snippet from an old manual. Establish the class and package versions first: the automatic-capture setting in question belongs to a different test flow from the one described in the Selenium2 troubleshooting report.

What to check Legacy Selenium RC Selenium2
Test base class named in the evidence PHPUnit_Extensions_SeleniumTestCase PHPUnit_Extensions_Selenium2TestCase
captureScreenshotOnFailure The legacy manual documents it alongside screenshot path and URL properties. A community report says this property does not exist on this base class.
What to investigate Property spelling and values, writable path, URL mapping, and what kind of failure occurred. The screenshot API or failure hook supported by the installed extension.
Historical version context The original report used PHPUnit 3.4.12. A separate report named PHPUnit 4.6 and phpunit-selenium 1.4.2.

Those version references describe historical reports, not a current compatibility matrix. Read the test class declaration and the project’s lockfile or installed package information. A setting being present in an old manual does not establish that it is supported by the class or extension version your project actually uses.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If the test uses the legacy Selenium RC class

Verify all three property names

The legacy manual lists three related properties: $captureScreenshotOnFailure, $screenshotPath, and $screenshotUrl. They serve different purposes: enable automatic capture, identify where the screenshot is saved, and provide the URL associated with that saved image. Check the spelling exactly. In the original report, the author had written screnshotUrl rather than screenshotUrl.

#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • 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

Use the manual for the exact syntax and defaults applicable to the project’s version. As a diagnostic checklist, verify that capture is enabled, the configured path is the intended local directory, and that directory exists and is writable by the process running the tests. Then check that the URL value corresponds to how that directory is exposed. A local filesystem path and a browser-accessible or report-accessible URL are not interchangeable.

The names below show the legacy property spellings only; they are not a complete configuration recipe for every PHPUnit Selenium release:

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • 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
$this->captureScreenshotOnFailure = true;
$this->screenshotPath = '/path/to/writable/screenshots';
$this->screenshotUrl = 'https://example.test/screenshots';

Do not copy those example values literally: choose a real writable location and the URL mapping your environment uses. If your class is Selenium2, these RC properties are not a fix merely because the names look plausible.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check the kind of failure that triggers capture

“The test failed” does not necessarily identify the same code path as “an assertion failed.” In the PHPUnit 3.4.12 report, the author found that a Selenium fail() call produced a failure without automatic capture, while a failed assertion did trigger capture. For that specific legacy setup, use a genuine failed assertion as a controlled diagnostic check. Do not leave a deliberately failing assertion in the test suite; use it temporarily, confirm whether a file appears, and remove it afterward.

Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • 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.

If an assertion failure captures but an explicit fail() does not, the setting and destination may be working while the trigger path differs. Treat that as a clue about the historical setup, not proof that every version handles these cases identically. Check the extension’s behavior for the installed version before restructuring production tests around it.

If the test uses Selenium2

Do not expect the legacy automatic property to work on PHPUnit_Extensions_Selenium2TestCase. The Selenium2 report explicitly says captureScreenshotOnFailure is not a property of that base class. Instead, find the screenshot facility and failure handling supported by the particular phpunit-selenium version in the project.

Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • 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

A community answer to that report describes taking a screenshot in a catch block and points to a ScreenshotListener example. That is a direction to investigate, not a version-independent snippet: confirm the method name, return format, and listener or hook interface against the installed extension. In particular, a screenshot API may return image data that your code must save to a file; the existence of a screenshot method does not imply automatic saving or attachment to a PHPUnit report.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Place failure capture where the browser session is still available, and preserve the original test failure if capture itself fails. Otherwise, a secondary error while writing an image can obscure the assertion or exception that caused the test to fail. Verify the actual extension callback lifecycle rather than assuming a hook from a different PHPUnit generation will run.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【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.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Check teardown and failure handling

If the class, property names, destination, and failure trigger are all consistent with the legacy setup, inspect custom tearDown and error-handling code. The original reporter said their teardown function was not compatible with PHPUnit 3.4 and removed it while investigating. That observation applies to that report; it does not mean every custom teardown is incompatible.

Look for code that closes or replaces the Selenium session before capture can happen, throws a new exception while handling the first failure, or prevents PHPUnit from completing its normal failure reporting. Temporarily simplify the custom teardown in a controlled diagnostic run, then restore compatible cleanup that does not mask the original failure. Keep the test result and any capture error distinguishable in logs or output.

A practical diagnostic sequence

  1. Read the test declaration. Identify whether it extends PHPUnit_Extensions_SeleniumTestCase or PHPUnit_Extensions_Selenium2TestCase.
  2. Confirm installed versions. Check the project’s dependency lockfile and installed packages; do not infer compatibility from a copied example.
  3. Choose the matching branch. For the legacy RC class, check the three property names and their values. For Selenium2, locate the supported screenshot API or failure hook for that installed extension.
  4. Test the trigger separately. In the legacy setup, compare a temporary assertion failure with the failure mechanism that originally did not capture. Remove the diagnostic failure afterward.
  5. Check the destination. Confirm that the output directory exists and is writable, and that the configured URL corresponds to how the saved file is exposed.
  6. Review lifecycle code. Simplify custom teardown or failure handling temporarily if needed, while ensuring the original failure is not hidden.
  7. Verify the artifact. Confirm that a screenshot file was actually created and can be opened. A test marked failed is not by itself evidence that an image was saved or attached.

Common symptoms and what they point to

Symptom Likely diagnostic direction
No screenshot on a Selenium2 test class Check whether legacy RC properties have been applied to a class that does not expose that property; use the installed Selenium2 extension’s supported capture mechanism.
No screenshot on the legacy class, but configuration looks right Check spelling, especially screenshotUrl, then verify the path is writable and the URL matches the directory’s exposure.
Assertion failure captures, explicit Selenium fail() does not This matches the behavior reported for PHPUnit 3.4.12. Validate against the exact legacy extension version in use.
A failure occurs but no image is saved Check whether the failure route invokes automatic capture, whether the browser is still available at that point, and whether custom teardown or error handling interrupts it.
Capture code reports another error Separate the original test failure from the capture/write error so that image handling does not replace the useful failure diagnosis.

Or skip the browser setup

If you need a screenshot of a URL without wiring screenshot capture into a PHPUnit Selenium failure hook, ScreenshotNeo provides a separate screenshot API. It is not a drop-in replacement for capturing the exact browser session or test state created by Selenium; it captures a URL independently.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

One cURL request:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for request options. ScreenshotNeo removes cookie or consent banners, newsletter popups, and chat widgets before capture; those cleanup steps can each be turned off. Bot checks, blank pages, timeouts, and failed loads are not billed, and cache hits cost nothing. Responses include X-Page-Verdict and X-Billed headers. Its MCP server offers 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 required; paid plans start at $5 for 3,000 screenshots. ScreenshotNeo is made by Yorker Media. Learn about ScreenshotNeo, or sign up for 1,000 free screenshots a month with no card.

What the historical reports establish—and what they do not

The legacy manual documents the three automatic-capture properties, and the original Stack Overflow report describes a spelling error, the difference between an explicit fail() and an assertion failure, and a teardown compatibility issue in its PHPUnit 3.4.12 setup. A separate Selenium2 discussion reports that the property is absent from its base class and describes manual capture or a listener as alternatives. Together, these sources support a useful diagnosis by class and failure path; they do not establish how every current PHPUnit or phpunit-selenium release behaves. Check the installed code and version-specific documentation before adopting an implementation.

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.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.