To capture a screenshot after every Playwright Test, set screenshot: 'on' in the top-level use section of playwright.config.ts. Playwright leaves automatic screenshots off by default; the setting below changes that global default for every test.
import { defineConfig } from '@playwright/test';
export default defineConfig({
use: {
screenshot: 'on',
},
});
Playwright writes the resulting image artifacts to the test output directory (commonly test-results). See the official configuration reference for the current option details.
Set the global screenshot mode to on
Playwright Test reads shared browser and artifact settings from the use object in your configuration file. Add the setting at the top level so every project and test inherits it:
import { defineConfig } from '@playwright/test';
export default defineConfig({
testDir: './tests',
use: {
screenshot: 'on',
},
});
Run the suite with your normal command, such as npx playwright test. After each test, Playwright records a screenshot and attaches it to the test result. If your configuration has several projects, this global use value is the default for all of them unless a project or test overrides it.
#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
The screenshot option belongs to Playwright Test configuration. It is not a switch that you add to a browser launch call. The documented default is 'off', so omitting the property will not create automatic screenshots.
Configuration reference: playwright.dev/docs/test-use-options.
Choose the right automatic capture mode
The mode controls when Playwright keeps an automatic screenshot. These are the four documented values:
| Mode | When a screenshot is captured | Best fit |
|---|---|---|
on |
After every test | Complete visual evidence for every pass and failure |
only-on-failure |
After tests that fail | Debugging failures while limiting artifact volume |
on-first-failure |
On a test’s first failure | Failure diagnostics without retaining repeated failure captures |
off |
Never automatically | Suites that do not need automatic image artifacts |
For failure-only diagnostics, change the configuration to:
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 problemsimport { defineConfig } from '@playwright/test';
export default defineConfig({
use: {
screenshot: 'only-on-failure',
},
});
Use on when the requirement is literally “always capture” rather than “capture when something breaks.” Saving an image for every passing test increases disk usage and the amount of data uploaded by a continuous-integration job, so failure modes are often a better operational choice for large suites.
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
Configure full-page and transparent screenshots
The setting can be a string or an object with a mode. The object form lets you request additional screenshot behavior:
import { defineConfig } from '@playwright/test';
export default defineConfig({
use: {
screenshot: {
mode: 'on',
fullPage: true,
omitBackground: true,
},
},
});
fullPage
With fullPage: true, Playwright captures the full scrollable page instead of only the current viewport. This is useful for long-page documentation, marketing pages, and smoke tests where content below the fold matters. It can create substantially larger files than viewport captures, especially on pages with large images.
omitBackground
omitBackground: true hides the default white page background so transparent areas can remain transparent. The option does not apply to JPEG output; use a format that supports transparency when you need an alpha channel. The automatic screenshot option follows the same screenshot constraints documented for Playwright Test.
Free tools Windows power users keep installed
One-click scans. No signup required.
If you only need the viewport, leave fullPage unset (or false) and avoid the extra image height. If your test page has sticky headers or lazy-loaded sections, full-page capture can also expose layout behavior that a viewport image would miss.
Scope the setting to a project or one test
A global default does not prevent narrower overrides. Put a different value in a project definition when, for example, Chromium should retain every image but a fast mobile project should keep only failures:
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
use: {
screenshot: 'on',
},
projects: [
{
name: 'desktop',
use: { ...devices['Desktop Chrome'] },
},
{
name: 'mobile-failure-artifacts',
use: {
...devices['iPhone 13'],
screenshot: 'only-on-failure',
},
},
],
});
For a one-test exception, use test.use() in the test file:
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.
import { test, expect } from '@playwright/test';
test.use({ screenshot: 'only-on-failure' });
test('checkout smoke test', async ({ page }) => {
await page.goto('https://example.com/checkout');
await expect(page.getByRole('heading', { name: 'Checkout' })).toBeVisible();
});
The inverse works too: keep a failure-only global policy and turn screenshots on for a small diagnostic test with test.use({ screenshot: 'on' }). Narrow overrides are useful when a handful of scenarios need complete visual history but the rest of the suite does not.
Recommended Free Tools
Understand automatic screenshots versus explicit screenshots
Automatic test artifacts
use.screenshot is a Playwright Test recording option. The runner decides when to capture and associates the file with the completed test result. This is the right tool for “after every test” or failure-artifact policies.
Capture at a precise point in a test
Use the page screenshot API when timing matters—for example, immediately after opening a menu or after dismissing a modal:
import { test } from '@playwright/test';
test('capture the open menu', async ({ page }) => {
await page.goto('https://example.com');
await page.getByRole('button', { name: 'Menu' }).click();
await page.screenshot({ path: 'artifacts/menu-open.png', fullPage: false });
});
This explicit call is independent of the automatic end-of-test capture. You can use both when you need a milestone image and a final-state image.
Visual regression assertions
Screenshot assertions such as expect(page).toHaveScreenshot() serve a different purpose: they compare a new image with a stored baseline and fail when the pixels differ beyond the assertion’s rules. They are not a replacement for the automatic artifact setting. Use automatic screenshots for diagnostic records and assertions for intentional visual-regression checks.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
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
Find and preserve the generated files
Playwright places screenshots, videos, and traces in its test output area; the default location is commonly test-results. The exact directory can be changed with the test output configuration used by your project. In a local run, inspect the report or output directory after the command completes. In CI, publish that directory as a job artifact so images remain available after the workspace is deleted.
Keep artifact retention proportional to the mode. Every-test capture can produce one image per test per project, while a matrix of browsers and devices multiplies that count. Failure-only modes reduce storage and upload time. Full-page images and high-density device settings increase file size further, so set retention and compression policies in your CI provider rather than silently deleting the files you need for diagnosis.
Performance and reliability considerations
- Runtime: taking an image adds work after each test. The effect is usually more noticeable in short tests, where screenshot time is a larger fraction of total runtime.
- Storage: estimate artifacts as tests multiplied by projects, retries, and retained runs. Full-page captures can be much larger than viewport images.
- Determinism: wait for the state you intend to record. A page screenshot taken while animations, network requests, or lazy images are still settling can differ from run to run.
- Parallel workers: parallel execution creates artifacts concurrently. Use the runner’s test-result metadata and unique output paths rather than writing explicit screenshots from every worker to one fixed filename.
- CI collection: configure your CI system to upload the test output directory even when the job fails. Otherwise the most useful images may disappear with the failed workspace.
Automatic screenshots do not enable video or trace recording. Those are separate recording options and must be configured independently when you need them.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshoot missing or unexpected screenshots
No files are produced
- Confirm the file is the configuration Playwright is loading (normally
playwright.config.ts) and thatscreenshotis nested insideuse, not beside it. - Check that you are running Playwright Test with
npx playwright test, rather than launching a browser through a separate script that does not read the test configuration. - Look in the configured test output directory and the HTML report; the image may be attached to a result instead of appearing beside your source test.
- If the value is
only-on-failureoron-first-failure, a passing test will not have an automatic image.
The image is only the viewport
Set fullPage: true in the object form of the option. Remember that full-page capture can increase image dimensions and artifact size.
Transparency is white or missing
Use omitBackground: true and an image format that supports transparency. The documented option does not apply to JPEG.
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 screenshot shows an intermediate state
Make the test wait for a meaningful condition—such as a visible heading, a loaded data row, or the disappearance of a spinner—before the action that ends the test. If exact timing matters, add an explicit page.screenshot() at the stable point and retain the automatic final-state capture separately.
CI storage fills quickly
Switch from on to only-on-failure or on-first-failure, remove unnecessary fullPage captures, and set an artifact retention period in CI. Keep the global setting broad only where its evidence is worth the recurring storage and upload cost.
Or skip the browser setup
If you need a rendered image from a URL rather than a test-run artifact, ScreenshotNeo provides a website screenshot API and MCP server. One request returns PNG, JPEG, WebP, or PDF output. It accepts cookie and consent banners as a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be disabled. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers.
Use the documented API examples at screenshotneo.com/docs/:
cURL
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Python
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)
Node.js
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
const buffer = Buffer.from(await res.arrayBuffer());
await import('node:fs/promises').then(fs => fs.writeFile('shot.webp', buffer));
ScreenshotNeo also offers an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. Its 63 options include full-page and element capture, device and retina settings, dark mode, custom CSS and JavaScript, waits, request blocking, headers, cookies, user-agent, timezone, geolocation, resizing, caching, signed links, asynchronous webhooks, bulk capture for up to 100 URLs per call, and a usage API. Every feature is on every plan: 1,000 screenshots per month are free with no card; paid plans start at $5 for 3,000, with yearly billing providing two months free. Create a free ScreenshotNeo account to start with the 1,000 monthly screenshots.
The Bottom Line
Use use: { screenshot: 'on' } for an automatic screenshot after every Playwright test. Switch to a failure mode to control artifact volume, use the object form for full-page or transparent captures, and use explicit page screenshots when you need a precise moment.
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.

