Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
FREEDOM251

Freedom251 › Blog › JavaScript

How to Fix Puppeteer Screenshot Tests That Fail Because of Animations

By Freedom251 Team · · 6 min read

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

To make Puppeteer screenshots repeatable, set the page to reduced motion when your app supports it, then disable only the CSS animations or transitions causing the mismatch. For JavaScript-driven motion, wait for an app-specific stable state. Puppeteer does not document Playwright’s animations: 'disabled' screenshot option, and network-idle waiting does not guarantee visual stability.

First identify what is changing

Before changing a baseline, compare repeated captures and locate the differing pixels. Check whether the region contains a CSS animation, transition, loading indicator, animated cursor, JavaScript-driven effect, or an unintended hover or focus state. A screenshot test can also vary because of viewport size, device scale, fonts, assets, test data, locale, or time-dependent content.

As an Amazon Associate I earn from qualifying purchases.

Puppeteer’s Page.screenshot() captures the current rendered page state; its documented screenshot options do not include a general animation-disabling switch. Keep capture settings and page state controlled before treating a changing baseline as an expected update.

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.

Try reduced motion when the application honors it

Puppeteer’s Page.emulateMediaFeatures() can set the prefers-reduced-motion media feature. This is a preference signal: page CSS and application code must respond to it. Set it before triggering the state you plan to capture.

#1 Best Overall
Sale
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black | 1080p with auto-light correction, built-in mic, privacy shutter, USB-A, compatible with Teams, Google Meet, Zoom and more
  • 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
await page.emulateMediaFeatures([
  { name: 'prefers-reduced-motion', value: 'reduce' },
]);

// Trigger or await the application state required by this test.
await page.screenshot({ path: 'page.png' });

Use the API signature supported by the Puppeteer version installed in your project; the cited API page is under the /next/ documentation path. If the application ignores reduced motion, this setting alone will not stop its animations.

Disable irrelevant CSS motion with a test-only stylesheet

For CSS transitions or animations that create irrelevant pixel differences, inject a narrowly scoped test stylesheet before capture. Puppeteer’s Page.evaluate() runs code in the page context, which lets a test add a style element. Scope rules to the unstable component when other animations are part of the intended visual state.

await page.evaluate(() => {
  const style = document.createElement('style');
  style.textContent = `
    .unstable-component,
    .unstable-component *,
    .unstable-component *::before,
    .unstable-component *::after {
      animation-duration: 0s !important;
      animation-delay: 0s !important;
      transition-duration: 0s !important;
      transition-delay: 0s !important;
    }
  `;
  document.head.appendChild(style);
});

await page.screenshot({ path: 'page.png' });

Replace .unstable-component with a selector from your page. Setting durations to zero can expose an initial or final state depending on the application’s CSS and timing. It changes rendered behavior and does not guarantee that a stateful JavaScript animation has settled; use an explicit application test mode or readiness signal when available.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Logitech C270 720p Webcam Plug-and-Play Wide Screen Video Calling - Black | Auto-Light Correct, Noise-Reducing Mic, Zoom, Microsoft, Teams, Skype, Nintendo Switch 2 New GameChat Mode, PC Mac compatible
  • 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.

Handle JavaScript-driven motion with an application signal

A CSS override cannot reliably settle motion driven by requestAnimationFrame, a JavaScript animation library, canvas rendering, timers, or application state. Inspect the code responsible for the changing region, then wait for the app’s signal that the desired frame or state is ready. If practical, have the application expose a deterministic test mode or state hook.

The correct signal is project-specific: for example, the application might expose a completion flag once a transition has reached the state the test is meant to capture. Use page.evaluate() to inspect page state only when you have a meaningful condition to test. A fixed sleep is a poor default: it can slow the suite and still capture a different frame.

Use network-idle waiting only for network-dependent loading

Puppeteer’s screenshot guide shows navigation with waitUntil: 'networkidle2', and Page.waitForNetworkIdle() waits for network inactivity and at least its configured idle period. These are loading aids, not animation controls: network quiet does not establish that CSS or JavaScript motion has finished.

Rank #3
Sale
NexiGo N60 1080P Webcam with Microphone, Software Control & Privacy Cover, USB HD Computer Web Camera, Plug and Play, for Zoom/Skype/Teams, Conferencing and Video Calling
  • 【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.
await page.goto('https://example.com', { waitUntil: 'networkidle2' });
// Still wait for the relevant application state or neutralize its CSS motion.
await page.screenshot({ path: 'page.png' });

Choose a navigation or network wait appropriate to the page. Do not rely on it as proof that the rendered image is visually stable.

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

Choose the fix that matches the source of motion

Approach Best for What it controls Limitation
emulateMediaFeatures with reduced motion Apps that honor reduced-motion preferences The media feature observed by page CSS or application logic Does not force every animation to stop.
Test-injected stylesheet CSS transitions or animations causing irrelevant differences Selected CSS properties in the page or component Can change intended visual state and does not ensure JavaScript motion has settled.
App-specific readiness or test hook JavaScript-driven or stateful animation The application-defined target state or frame Requires application support; the right signal depends on the project.
networkidle2 or waitForNetworkIdle() Network-dependent page loading A period of network quiet Does not disable or wait for animations to finish.
Playwright screenshot assertion option Tests using Playwright Playwright’s documented finite and infinite animation behavior animations: 'disabled' is a Playwright API, not a documented Puppeteer screenshot option.

Playwright documents its separate screenshot assertion API, including the animation option. Do not copy that option into Puppeteer code and expect it to work.

Make the rest of the capture state repeatable

  • Keep viewport dimensions and device scale consistent across runs.
  • Wait for required fonts, images, and other assets rather than capturing before they are ready.
  • Use the same test data, locale, and time-dependent state when comparing images.
  • Set the intended focus state, and move the pointer away from hover-sensitive controls if hover is not part of the screenshot. Playwright’s visual comparison guidance also calls out unwanted hover effects.
  • Only update a baseline after confirming that the difference is an intended change, not timing noise.

Troubleshooting common failures

The reduced-motion setting has no effect

Check whether the page defines reduced-motion styling or application logic. Emulating the preference does not impose a universal stop on animations; add a test-only CSS rule for CSS motion or use an app-specific hook for JavaScript motion.

Rank #4
Sale
EMEET C960 1080P Webcam with Microphone, 2 Mics, 90° FOV, Computer Camera | USB Type-A & A-to-C Adapter, Fixed Focus, Plug&Play for Zoom/Teams/Facetime/YouTube/Google Meet/Switch 2 Camera, 2025 Version
  • 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)

The screenshot still changes after CSS durations are set to zero

Confirm that the changing element matches the stylesheet selector and that the difference is actually CSS-driven. If motion comes from JavaScript, canvas, or changing application state, wait for the intended state rather than relying on CSS properties.

The test passes with a long delay but remains flaky

Replace the arbitrary delay with a condition tied to the page’s intended state. A delay measures elapsed time, not whether the correct frame has been reached.

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

networkidle2 returns but the image is still different

Network quiet only addresses network activity. Add a visual-state strategy appropriate to the changing region, such as reduced motion, targeted CSS, or an application readiness signal.

Best Value
Logitech C920x HD Pro PC Webcam Full 1080p/30fps Video - Black | 30fps Video, Clear Audio, Light Correction, Works with Teams, Meet, Zoom, Nintendo Switch 2, Mac, Tablet
  • 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

A Playwright option is rejected or ignored

Verify which automation library the test uses. Playwright documents animations: 'disabled' for its screenshot assertions; Puppeteer’s documented ScreenshotOptions do not list that option.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

For a screenshot returned from one API request, ScreenshotNeo accepts a URL and can return a clean screenshot or PDF. Its cleanup can accept cookie or consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the page verdict and billing status in headers. It also offers an MCP server with take_screenshot, get_page_info, and capture_pdf tools for AI agents. This is a capture service, not a replacement for controlling application-specific animation state in a Puppeteer test.

See the ScreenshotNeo API documentation. Example cURL request:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo’s free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Learn about ScreenshotNeo or sign up for the free plan.

Frequently Asked Questions

Does Puppeteer have a screenshot option to disable animations?

Puppeteer’s documented screenshot options do not list Playwright’s `animations: ‘disabled’` option.

Will reduced motion stop every animation?

No. The application must respond to the `prefers-reduced-motion` preference; JavaScript-driven motion may need an app-specific signal or test mode.

What should I wait for before capturing a JavaScript animation?

Wait for an application-defined condition that indicates the exact state or frame your test intends to capture.

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

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.

JavaScriptPuppeteerscreenshot testingvisual regression testingWeb development

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

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

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.