Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

How to Screenshot a Webpage with SVG Animations Paused in Playwright

Use SVG pauseAnimations() for inline SVG clocks and Playwright’s animations: disabled for CSS animations, transitions, and Web Animations.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For inline SVG that uses SMIL animations, pause each SVG root with pauseAnimations() in the page before capturing. Also set Playwright’s animations: 'disabled' option to handle CSS animations, CSS transitions, and Web Animations. These are complementary controls: Playwright’s screenshot option does not promise to freeze every animation technology at its current frame.

Pause SVG and Playwright-managed animations before capture

In JavaScript, pause SVG roots in the page context, then take the screenshot with Playwright’s animation handling enabled:

As an Amazon Associate I earn from qualifying purchases.

await page.evaluate(() => {
  document.querySelectorAll('svg').forEach(svg => svg.pauseAnimations());
});
await page.screenshot({ path: 'page.png', animations: 'disabled' });

This targets SVG elements in the page DOM. The pauseAnimations() method stops each SVG document fragment’s animation clock at its current position; it does not select a particular frame. If a test needs a specific visual state, set up that state deliberately before pausing.

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

Playwright’s page screenshot API documents animations: 'disabled' for CSS animations, CSS transitions, and Web Animations. Its documented behavior is not equivalent to pausing everything where it currently appears: finite animations are fast-forwarded to completion, firing transitionend, while infinite animations are canceled to their initial state before being played again after the screenshot. The page screenshot default is 'allow'.

#1 Best Overall
Samsung 14" Galaxy Chromebook Go Laptop PC Computer, Intel Celeron N4500 Processor, 4GB RAM, 64GB Storage, ChromeOS, XE340XDA-KA2US, Student Laptop, Silver
  • SLIM. LIGHTWEIGHT. READY TO GO: The all-new slim design is perfect for busy lives on the go.
  • SKILLFULLY DESIGNED. MILITARY TOUGH: Built with premium craftsmanship to withstand the occasional drop or ding.
  • ALL-DAY, ALL-IN-ONE CHARGING: Power through your school day – and beyond – with a long-lasting 12-hour battery.¹
  • 3X FASTER THAN THE PREVIOUS GENERATION OF WIFI: Crush your schoolwork in record time with Wi-Fi that’s three times faster than the previous generation of Wi-Fi.
  • YOUR PHONE AND CHROMEBOOK WORK BETTER TOGETHER: Easily transfer files between devices, and control your phone right from your Chromebook.

Use the same setup for Python and locator screenshots

Python async page screenshot

Run the pause in the page context, then pass the Python API’s string value "disabled":

await page.evaluate("""() => {
  document.querySelectorAll('svg').forEach(svg => svg.pauseAnimations());
}""")
await page.screenshot(path="page.png", animations="disabled")

Capture a locator

Pause the SVG roots on the page before taking a locator screenshot. Then use the corresponding locator option:

await page.evaluate(() => {
  document.querySelectorAll('svg').forEach(svg => svg.pauseAnimations());
});
await page.getByTestId('target').screenshot({ path: 'element.png', animations: 'disabled' });

For Python, the locator screenshot option is documented with animations="disabled" as well; see the Python locator screenshot documentation. Its allow value is the default.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
HP Chromebook 14 Laptop, Intel Celeron N4120, 4 GB RAM, 64 GB eMMC, 14" HD Display, Chrome OS, Thin Design, 4K Graphics, Long Battery Life, Ash Gray Keyboard (14a-na0226nr, 2022, Mineral Silver)
  • FOR HOME, WORK, & SCHOOL – With an Intel processor, 14-inch display, custom-tuned stereo speakers, and long battery life, this Chromebook laptop lets you knock out any assignment or binge-watch your favorite shows..Voltage:5.0 volts
  • HD DISPLAY, PORTABLE DESIGN – See every bit of detail on this micro-edge, anti-glare, 14-inch HD (1366 x 768) display (1); easily take this thin and lightweight laptop PC from room to room, on trips, or in a backpack.
  • ALL-DAY PERFORMANCE – Reliably tackle all your assignments at once with the quad-core, Intel Celeron N4120—the perfect processor for performance, power consumption, and value (2).
  • 4K READY – Smoothly stream 4K content and play your favorite next-gen games with Intel UHD Graphics 600 (3) (4).
  • MEMORY AND STORAGE – Enjoy a boost to your system’s performance with 4 GB of RAM while saving more of your favorite memories with 64 GB of reliable flash-based eMMC storage (5).

Understand which animations each control affects

Control What it covers Frame behavior Scope
Playwright screenshot animations: 'disabled' CSS animations, CSS transitions, and Web Animations, as documented by Playwright Finite animations fast-forward to completion; infinite animations are canceled to their initial state for the screenshot The screenshot operation
SVG pauseAnimations() The SVG document fragment’s animation clock Freezes the clock at its current position; does not choose a canonical time SVG roots in the page DOM
reducedMotion: 'reduce' Emulates the prefers-reduced-motion media feature Not documented as pausing the SVG animation clock Browser context media-feature emulation

SVG declarative animation includes SMIL elements such as <animate>, <animateMotion>, and <animateTransform>; the W3C SVG Integration document distinguishes declarative animation from other mechanisms. A page can also move SVG through JavaScript. Such script-driven behavior may need an application-specific way to set or hold its state.

Do not use reduced-motion emulation as a general substitute for either screenshot animation disabling or pauseAnimations(). Playwright describes reduced motion as media-feature emulation, not as a universal animation pause switch; see its context option documentation.

Make the captured frame reproducible

  • Decide whether the test needs the animation’s current state or a specific named frame. The pause call freezes the current SVG time, which may differ between runs if capture timing varies.
  • Set application state and timing before pausing. Then pause the SVG roots and take the screenshot.
  • Use animations: 'disabled' for the CSS and Web Animations behavior it documents, but account for its fast-forward/cancel semantics when those animations affect the desired output.
  • Keep the capture environment and app state controlled. A stable screenshot depends on more than pausing one animation mechanism.

Scope and known limitation

A Playwright GitHub issue opened June 21, 2024 reports inline SVG SMIL continuing during a locator screenshot with animations: 'disabled' in Playwright 1.41.1. That is a concrete reproduction for adding an explicit SVG pause when SMIL matters; it does not establish behavior for every later Playwright release or browser engine.

The loop shown above operates on SVG roots present in the page DOM. It does not demonstrate control over SVG loaded as an external image resource, and it is not a universal solution for script-driven animation. The available documentation and issue report do not settle SMIL support release by release, so verify the behavior with the Playwright version and browser engine used by your tests.

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

Troubleshoot screenshots that still move or differ

  • Inline SVG SMIL still appears animated: call pauseAnimations() on the SVG roots from the page context before capture, then verify the target Playwright version and browser engine.
  • The SVG freezes on a different frame across runs: pausing holds the current clock position, not a prescribed time. Set the desired application or animation state before calling it.
  • CSS motion differs from the SVG: use animations: 'disabled' for the CSS animations, transitions, and Web Animations it covers, and remember that Playwright may fast-forward or cancel those animations rather than freeze them at the current frame.
  • Reduced motion did not stop the animation: reducedMotion: 'reduce' emulates a preference; it is not documented as a universal pause mechanism.
  • The SVG is an external image or is driven by page JavaScript: the DOM-root loop does not establish control over those cases. Use the application’s own state controls or investigate the specific embedding and animation mechanism.
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 API instead of configuring Playwright, ScreenshotNeo takes a URL in one GET request. This produces an ordinary webpage screenshot; it is not a control for selecting or freezing a particular SVG animation frame.

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 banners, newsletter popups, and chat widgets before the shot; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. It also provides an MCP server with screenshot tools for AI agents. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.

Learn about ScreenshotNeo or sign up for 1,000 free screenshots a month, no card required.

Rank #4
HP 14" HD Chromebook Laptop for Students, Intel Quad-Core N4120(> N4020), 4GB RAM, 64GB eMMC, WiFi, Webcam, HDMI, USB-A&C, 14 Hours Battery Life, Zoom, Chrome OS, CUE Accessories
  • Intel Celeron N4120: 4 Cores & Threads, 1.1GHz Base Clock, Up to 2.6GHz Boost Clock, 4MB Cache, Intel UHD Graphics 600. The perfect combination of performance, power consumption, and value helps your device handle multitasking smoothly and reliably with four processing cores to divide up the work.

Frequently Asked Questions

Does `animations: ‘disabled’` pause inline SVG SMIL?

Do not rely on it for SMIL: a Playwright 1.41.1 issue reported inline SVG SMIL continuing during a locator screenshot. Explicitly call `pauseAnimations()` and verify your version and browser.

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

Can I use this method with a locator screenshot?

Yes. Pause the SVG roots in the page context first, then take the locator screenshot with its `animations: ‘disabled’` option.

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.

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.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
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.