The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
In Playwright, “snapshot” can mean three different things: a screenshot image of rendered pixels, an ARIA snapshot of accessible structure, or DOM snapshots recorded in a trace around an action. For a visual image, use page.screenshot(); for an accessibility structure assertion, use aria_snapshot() with to_match_aria_snapshot(); for diagnosing what happened during interactions, record and open a trace. This guide shows the Python workflows and how to make their output useful and repeatable.
Choose the snapshot type for the job
| Goal | Playwright artifact | Use it for |
|---|---|---|
| Capture rendered pixels | PNG, JPEG, or WebP image | Visual review, screenshots for documentation, or image-based comparison. |
| Check accessible structure | ARIA snapshot represented as YAML | Assertions about roles, accessible names, and relevant attributes. |
| Understand an interaction | Trace with action-level DOM snapshots and screenshots | Debugging the state before, during, and after an action. |
These artifacts answer different questions. A screenshot does not tell you whether a control has the right accessible role, an ARIA snapshot is not a picture, and a trace is a debugging record rather than a single screenshot baseline.
How do I take a screenshot with Playwright Python?
Install Playwright for Python, install a browser, then navigate to a page and call page.screenshot(). The basic synchronous script below writes a viewport screenshot to screenshot.png. See the Playwright Python getting started guide for setup details.
Recommended Free Tools
from pathlib import Path
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
page.goto("https://example.com")
page.screenshot(path="screenshot.png")
browser.close()
print(Path("screenshot.png").resolve())
The call can save to a path and also returns image bytes. The options control the captured area, format, scale, quality where supported, and treatment of unstable content. Refer to the Page screenshot API for the supported options in your installed Playwright version.
#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
Capture the full scrollable page
Pass full_page=True to capture beyond the current viewport:
page.screenshot(path="full-page.png", full_page=True)
This captures the page’s full scrollable height, not just what is currently visible. A very tall page can produce a large image; if your purpose is a particular section, capture a locator instead.
Choose an image format and size
Playwright supports PNG, JPEG, and WebP screenshot output. The format can be specified with type; use quality for lossy formats where supported. scale controls whether output dimensions follow CSS pixels or device scale. For example:
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchpage.screenshot(path="page.webp", type="webp", quality=80, scale="css")
Use PNG when you need lossless output, especially for crisp text or pixel comparison. JPEG and WebP can reduce file size but may introduce compression differences. The appropriate choice depends on whether fidelity or smaller files matter more.
Capture one element
Use a locator screenshot when the intended artifact is a component rather than the entire page. Locator screenshots scroll the element into view and perform actionability checks:
Rank #2
- 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)
card = page.get_by_role("article").first
card.screenshot(path="article-card.png")
Prefer locator screenshots over the discouraged ElementHandle screenshot approach. A locator capture of a scrollable element includes only the content currently scrolled into view; it is not a request to export every item inside that element. If an overlay covers the target or the target never becomes actionable, the capture may fail or not show the intended content. See the Locator API.
Make visual screenshots repeatable
A screenshot records a rendered moment, so identical code can produce different images if the page state changes. Wait for the state that matters rather than assuming that navigation means every image, animation, or network request has settled.
Wait for a meaningful page condition
Wait for a selector that marks the content you need, then capture:
page.goto("https://example.com")
page.locator("main h1").wait_for(state="visible")
page.screenshot(path="ready.png", full_page=True)
If a site loads data after navigation, this ties the capture to visible content. For complex applications, use the application’s actual ready state or a specific locator instead of an arbitrary delay.
Disable motion and mask volatile regions
Animations and changing content can make screenshots unstable. The screenshot API supports animations="disabled", masks for elements that should not influence the visual result, and a style option for applying CSS to hide or stabilize page content. These are useful for visual tests where timestamps, rotating banners, or personalized regions are outside the assertion’s purpose.
page.screenshot(
path="stable.png",
full_page=True,
animations="disabled",
mask=[page.locator(".live-clock"), page.locator(".user-avatar")],
style=".rotating-banner { visibility: hidden !important; }"
)
Mask or hide only content that is intentionally irrelevant to the test. Otherwise, stabilization can conceal a real regression. Check the screenshot API reference for option details and compatibility.
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.
How do I assert an ARIA snapshot in Playwright Python?
An ARIA snapshot describes the accessible structure of a page or locator, including roles, accessible names, and attributes, as YAML. It is not a pixel capture. The Playwright Python documentation describes the feature this way: “With Playwright’s Snapshot testing you can assert the accessibility tree of a page against a predefined snapshot template.” See the Snapshot testing guide.
Capture or inspect the accessible structure
Use page.aria_snapshot() for a page-level representation, or scope the output to a locator when you only need a particular region:
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
page.goto("https://example.com")
print(page.aria_snapshot())
print(page.get_by_role("main").aria_snapshot())
browser.close()
Compare against a focused template
For an assertion in a Playwright test, use expect(page).to_match_aria_snapshot(). A focused example:
from playwright.sync_api import expect
def test_main_heading(page):
page.goto("https://example.com")
expect(page.get_by_role("main")).to_match_aria_snapshot("""
- heading "Example Domain" [level=1]
""")
Keep the template limited to structure your test actually depends on. A huge page-wide snapshot can be cumbersome to interpret and maintain, and dynamic content is a poor candidate for exact snapshot comparison. Combine a focused structure check with precise assertions for critical behavior, such as whether a button is enabled or a link has the expected destination. The Locator API documents locator-level ARIA snapshots.
Use trace snapshots to debug actions
When the question is “what did the page look like when this action ran?”, record a trace and inspect it in Trace Viewer. A trace can contain before, action, and after DOM snapshots for actions; its documented setup enables screenshots in traces by default. This gives the DOM context and visual context around an interaction instead of reducing the diagnosis to a standalone screenshot. Follow the Trace Viewer guide for recording and opening traces.
Rank #4
- 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.
In a Python test, tracing can be started and stopped on the browser context:
def test_checkout(page):
context = page.context
context.tracing.start(screenshots=True, snapshots=True, sources=True)
try:
page.goto("https://example.com")
page.get_by_role("button", name="Continue").click()
# Add the assertions for the behavior being investigated.
finally:
context.tracing.stop(path="trace.zip")
Open the resulting archive with the Trace Viewer using the procedure supported by your Playwright installation. Inspect the action timeline and its snapshots to see whether the expected control was present, covered, or changed state. Trace options and features evolve; consult current documentation and release notes rather than assuming an option from another version applies.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Run screenshot capture asynchronously
Playwright offers synchronous and asynchronous Python APIs. In an asyncio application, use the async API rather than blocking the event loop with the synchronous version:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
import asyncio
from playwright.async_api import async_playwright
async def main():
async with async_playwright() as p:
browser = await p.chromium.launch()
page = await browser.new_page()
await page.goto("https://example.com")
await page.screenshot(path="screenshot.png", full_page=True)
await browser.close()
asyncio.run(main())
The browser must be closed even if capture or navigation raises an exception. In a larger application, use context managers or try/finally cleanup so failures do not leave browser processes running.
Or skip the browser setup
If you need a website screenshot rather than an in-process Playwright test, ScreenshotNeo takes a screenshot with one GET request. Its API can return PNG, JPEG, WebP, or PDF; the request below saves a WebP capture of Stripe:
Best Value
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 parameters. Cookie and consent banners, newsletter popups, and chat widgets are removed before capture; each step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers report the page verdict and billing status. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 screenshots.
Sign up for ScreenshotNeo free: 1,000 screenshots a month, no card required.
Troubleshooting common snapshot problems
- The screenshot is blank or incomplete: confirm navigation succeeded and wait for a meaningful content locator to become visible before capture. For lazy-loaded content, scroll or otherwise trigger the content before expecting it to render.
- The image differs between runs: identify animation, timestamps, rotating content, or personalized elements; disable animations or mask/hide only the unstable regions that are not part of the test.
- A locator screenshot times out: check that the locator matches the intended element and that it can become visible and actionable. An overlay or off-state UI can prevent the expected capture.
- A component capture omits content: if the target is scrollable, locator screenshots capture the currently scrolled content rather than exporting all of its internal scroll area. Capture the page or prepare the element’s scroll position to match your requirement.
- An ARIA snapshot assertion is brittle: narrow the snapshot to the relevant locator, remove irrelevant dynamic structure from the expectation, and assert individual behaviors separately.
- The trace lacks useful context: ensure tracing is started before the action under investigation and stopped to a file after it. Include snapshots and screenshots in the trace configuration, then open the generated archive in Trace Viewer.
- Browser launch or import fails: install the Playwright Python package and its browser binaries using the setup instructions for your environment; a package installation alone may not install the browser executable.
Which approach should you use?
Use page.screenshot() when the deliverable is an image, locator screenshots for a component, ARIA snapshots when the test concerns accessible structure, and traces when you need to diagnose action history. For repeatability, make the relevant page state explicit and neutralize only variation that does not matter to the test. Version-specific features change over time; the Python release notes are the authority for what a particular Playwright release supports: Playwright Python release notes.
Frequently Asked Questions
Is a Playwright ARIA snapshot an image?
No. It is a YAML representation of accessible structure; use page.screenshot() for an image.
Can I take a screenshot of only one element?
Yes. Call screenshot() on a locator, such as page.get_by_role("main").screenshot(path="main.png").
Should I use screenshots or ARIA snapshots for accessibility tests?
ARIA snapshots check accessible structure. Screenshots can show visual presentation, but they do not replace structural accessibility assertions.
Free tools Windows power users keep installed
One-click scans. No signup required.
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.

