Playwright has three different controls that can sound like “screenshot retries”: rerunning a failed test, giving a visual assertion more time to stabilize, and setting a timeout on a direct screenshot capture. Choose the one that matches the failure. For a flaky visual comparison, first wait for the page’s meaningful state and adjust toHaveScreenshot’s timeout; use test retries for failures that remain intermittent.
Choose the right kind of retry
These controls operate at different scopes and respond to different problems. A longer timeout is not the same as rerunning a test, and a screenshot capture timeout is not a retry count.
As an Amazon Associate I earn from qualifying purchases.
| Control | Scope and trigger | Where to configure it |
|---|---|---|
| Test retries | Reruns the whole test after it fails. | retries in Playwright Test configuration or --retries on the CLI. |
toHaveScreenshot timeout |
Gives the visual assertion more time to obtain two consecutive matching screenshots and compare with the baseline. | The assertion’s timeout option or shared expect.timeout. |
page.screenshot timeout |
Limits how long a direct screenshot capture operation may take. | The timeout option passed to page.screenshot. |
By default, Playwright Test does not retry failed tests. The documented default test timeout is 30 seconds, the default expect timeout is 5 seconds, and action and navigation timeouts have no default limit. A direct page.screenshot timeout defaults to zero. These settings are independent; change only the one that corresponds to the observed failure. Playwright retries · Playwright timeouts · Page API
Stabilize a visual assertion
toHaveScreenshot repeatedly captures the page until two consecutive screenshots match, then compares the result with the expected baseline. Its retry window uses the configured expect timeout unless you override it on the assertion. Wait for an application condition that matters before asking for the screenshot; do not use a longer assertion timeout to hide a page that never reaches the expected state.
#1 Best Overall
- Compatible with Nintendo Switch 2’s new GameChat mode
- Auto-Light Balance: RightLight boosts brightness by up to 50%, reducing shadows so you look your best—compared to previous-generation Logitech webcams (1)
- Privacy with a Slide: The integrated webcam cover makes it easy to get total, reliable privacy when you're not on a video call
- Built-In Mic: The built-in microphone lets others hear you clearly during video calls
- Easy Plug-And-Play: The Brio 101 works with most video calling platforms, including Microsoft Teams, Zoom and Google Meet—no hassle; it just works
import { test, expect } from '@playwright/test';
test('dashboard screenshot is stable', async ({ page }) => {
await page.goto('/dashboard');
await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible();
await expect(page).toHaveScreenshot({ timeout: 15_000 });
});
The 15-second value is an example, not a universal recommendation. Tune it to the app and CI environment, and verify that the page actually settles. The assertion option and behavior are documented in PageAssertions API and Visual comparisons.
Set a shared assertion timeout
If many assertions need a different retry window, configure the shared expect timeout rather than repeating an option. This controls assertions, including visual assertions that inherit it; it does not change the test’s overall timeout or make the test runner rerun failed tests.
Rank #2
- Compatible with Nintendo Switch 2’s new GameChat mode
- Crisp HD 720p/30 fps video calls with diagonal 55° field of view and auto light correction. Compatible with popular platforms including Skype and Zoom.
- The built-in noise-reducing mic makes sure your voice comes across clearly up to 1.5 meters away, even if you’re in busy surroundings.
- C270’s RightLight 2 feature adjusts to lighting conditions, producing brighter, contrasted images to help you look good in all your conference calls.
- The adjustable universal clip lets you attach the camera securely to your screen or laptop, or fold the clip and set the webcam on a shelf. You’re always ready for your next video call.
import { defineConfig } from '@playwright/test';
export default defineConfig({
expect: {
timeout: 10_000,
},
});
Rerun the complete failed test
Use test retries when a test sometimes fails for reasons beyond the screenshot assertion itself. A retry begins the test again; it does not repeat only the screenshot call. Set a project policy in playwright.config.ts:
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →import { defineConfig } from '@playwright/test';
export default defineConfig({
retries: 2,
});
Or set retries for a run from the command line:
npx playwright test --retries=2
Playwright labels a test flaky when its first attempt fails and a retry passes. If the first attempt and all retries fail, the test is failed. Treat retries as a resilience policy and a diagnostic signal, not evidence that the screenshot is correct. See Playwright’s retry documentation.
Rank #3
- 【Full HD 1080P Webcam】Powered by a 1080p FHD two-MP CMOS, the NexiGo N60 Webcam produces exceptionally sharp and clear videos at resolutions up to 1920 x 1080 with 30fps. The 3.6mm glass lens provides a crisp image at fixed distances and is optimized between 19.6 inches to 13 feet, making it ideal for almost any indoor use.
- 【Wide Compatibility】Works with USB 2.0/3.0, no additional drivers required. Ready to use in approximately one minute or less on any compatible device. Compatible with Mac OS X 10.7 and higher / Windows 7, 8, 10 & 11 / Android 4.0 or higher / Linux 2.6.24 / Chrome OS 29.0.1547 / Ubuntu Version 10.04 or above. Not compatible with XBOX/PS4/PS5.
- 【Built-in Noise-Cancelling Microphone】The built-in noise-canceling microphone reduces ambient noise to enhance the sound quality of your video. Great for Zoom / Facetime / Video Calling / OBS / Twitch / Facebook / YouTube / Conferencing / Gaming / Streaming / Recording / Online School.
- 【USB Webcam with Privacy Protection Cover】The privacy cover blocks the lens when the webcam is not in use. It's perfect to help provide security and peace of mind to anyone, from individuals to large companies. 【Note:】Please contact our support for firmware update if you have noticed any audio delays.
- 【Wide Compatibility】Works with USB 2.0/3.0, no additional drivers required. Ready to use in approximately one minute or less on any compatible device. Compatible with Mac OS X 10.7 and higher / Windows 7, 10 & 11, Pro / Android 4.0 or higher / Linux 2.6.24 / Chrome OS 29.0.1547 / Ubuntu Version 10.04 or above. Not compatible with XBOX/PS4/PS5.
Set a timeout for direct screenshot capture
When calling page.screenshot() directly, its timeout option limits the capture operation. It does not ask Playwright Test to rerun the test or give toHaveScreenshot a longer stabilization window.
await page.screenshot({
path: 'page.png',
timeout: 10_000,
});
The documented default for this option is zero. For available screenshot options, consult the Page API.
Rank #4
- 1080P Webcam with Cover for Video Calls - EMEET computer webcam provides design and Optimization for professional video streaming. Realistic 1920 x 1080p video, 5-layer anti-glare lens, providing smooth video. C960 computer camera delivers 1920x1080 video with fixed focus (11.8–118.1 inches), so as to provide a clearer image. C960 USB webcam has a cover and can be removed automatically to meet your needs for privacy. For optimal image performance, use the webcam in a well-lit environment.
- Built-in 2 Omnidirectional Mics - EMEET webcam with microphone for desktop features 2 built-in omnidirectional microphones, picking up your voice to create clear audio for communication. When installing the webcam, select EMEET C960 as the default microphone input device in your computer and video applications and select C960 as the default device in Zoom/Teams and ensure microphone permissions are enabled for proper use. Please note that C960 does not include built-in speakers.
- Automatic Light Adjustment - Automatic exposure adjustment is applied in EMEET HD webcam 1080p so that the streaming webcam can deliver stable image performance. EMEET C960 camera for computer also features color adjustment and exposure optimization to help you look your best. For optimal video quality, it is recommended to use the webcam in normal or well-lit environments and select suitable video settings in your application. Proper lighting helps achieve a clearer and more balanced image.
- Plug-and-Play & Upgraded USB Connectivity - New C960 webcam features both USB Type-A & A-to-C adapter connections for wider compatibility. For stable performance, connect the webcam directly to the computer's main USB port and ensure the device is recognized correctly. If a hub or docking station is used, please ensure it provides sufficient power and stable data transmission, as limited ports may affect performance. 90° wide-angle lens captures more participants without frequent adjustments.
- High Compatibility & Multi Application - C960 webcam for laptop is compatible with Windows 10/11, macOS 10.14+, and Android TV 7.0+. Not supported: Windows Hello, TVs, tablets, or game consoles. It works with Zoom, Teams, Facetime, Google Meet, YouTube and more. Please select C960 webcam as the default camera and microphone device in your application and ensure camera/microphone permissions are enabled, especially on macOS. (Tips: Incompatible with Windows Hello)
Reduce visual flakiness at its source
Wait for application state, not elapsed time
Wait for a locator or web-first assertion tied to the state the screenshot needs, such as a heading becoming visible. Playwright’s Page API warns: “Tests that wait for time are inherently flaky.” Avoid using page.waitForTimeout() as production synchronization; a fixed sleep can be too short on a slow run and waste time on a fast one. See the Page API and Assertions guide.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Control content that changes between captures
Review whether animation, timestamps, rotating content, fonts, or network-dependent UI could be changing the image. Playwright supports animation controls and styling for screenshots; the screenshot API also supports stylesheet options that can help normalize content. Apply these only to differences that are genuinely irrelevant to the test, so a real visual regression is not hidden. Check the visual comparison guidance and Page API for the options available in your installed version.
Best Value
- Compatible with Nintendo Switch 2’s new GameChat mode
- HD lighting adjustment and autofocus: The Logitech webcam automatically fine-tunes the lighting, producing bright, razor-sharp images even in low-light settings. This makes it a great webcam for streaming and an ideal web camera for laptop use
- Advanced capture software: Easily create and share video content with this Logitech camera that is suitable for use as a desktop computer camera or a monitor webcam
- Stereo audio with dual mics: Capture natural sound during calls and recorded videos with this 1080p webcam, great as a video conference camera or a computer webcam
- Full HD 1080p video calling and recording at 30 fps. You'll make a strong impression with this PC webcam that features crisp, clearly detailed, and vibrantly colored video
Keep baseline and run environments consistent
Rendering can vary with host operating system, browser version, settings, hardware, power source, and headless mode. Generate and compare baselines in a consistent environment where practical; otherwise, environment changes can look like application regressions. Playwright documents these sources of variation in its visual comparisons guide.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshoot the failure you actually have
- The screenshot assertion times out: confirm the page reached the expected state, then increase the assertion’s
timeoutor sharedexpect.timeoutonly as needed. A longer wait cannot fix a page that remains unsettled or a real image mismatch. - The whole test fails intermittently: inspect the failed attempt and determine whether the cause is test-level instability. If appropriate, configure
retriesor use--retries; remember that the complete test starts again. page.screenshot()exceeds its limit: set or revise that operation’s owntimeout. Changing test retries or the expect timeout does not alter this capture limit.- The screenshot differs from its baseline every run: investigate dynamic content and rendering-environment differences before adding retries. A retry cannot make a persistent difference correct.
- A screenshot option is unrecognized: compare the installed Playwright version with the current API documentation. The docs identify
toHaveScreenshotas added in v1.23, screenshot styling options as added in v1.41, and the AbortSignal option as added in v1.62; version-specific availability should be checked against the project’s version.
Or skip the browser setup
For a one-request capture instead of managing a Playwright browser and test, ScreenshotNeo accepts a URL and returns an image or PDF. The cURL example saves a WebP image; create an API key first and replace YOUR_API_KEY.
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. ScreenshotNeo accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; those steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and the response identifies the page verdict and billing status in headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for AI agents using Claude, Cursor, or another MCP client. The free plan includes 1,000 shots a month without a card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan.
Frequently Asked Questions
Does Playwright retry a screenshot automatically?
A toHaveScreenshot assertion captures repeatedly until two consecutive images match, then compares against its baseline. It does not rerun the whole test; configure test retries separately.
Which timeout should I change for a slow visual assertion?
Set the toHaveScreenshot option timeout, or the shared expect.timeout if the policy should apply across assertions.
What does the page.screenshot timeout do?
It limits the direct capture operation. It is separate from both the visual assertion timeout and Playwright Test’s whole-test retries.
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.
Free tools Windows power users keep installed
One-click scans. No signup required.




