Free tools Windows power users keep installed
One-click scans. No signup required.
Use a locator for the button and call screenshot():
const saveButton = page.getByRole('button', { name: 'Save' });
await saveButton.screenshot({ path: 'button.png' });
Playwright scrolls the element into view, performs its actionability checks, and clips the image to the button’s rendered bounds. Without path, the method returns a Promise<Buffer> that you can process or upload in memory.
Capture a button image with a role locator
A role-and-name locator usually matches how a user identifies a control and is less brittle than a DOM path. The accessible name can come from visible text, an associated label, or an aria-label.
import { test } from '@playwright/test';
test('save the Save button', async ({ page }) => {
await page.goto('https://example.com');
const saveButton = page.getByRole('button', { name: 'Save' });
await saveButton.screenshot({ path: 'button.png' });
});
When a path is supplied, Playwright infers the format from its extension. Use .png, .jpeg, or .webp as appropriate. The locator screenshot is different from page.screenshot(): the latter captures the page viewport (or the full page when configured), while the locator method captures only the target element.
#1 Best Overall
- Compact Mouse: With a comfortable and contoured shape, this Logitech ambidextrous wireless mouse feels great in either right or left hand and is far superior to a touchpad
- Durable and Reliable: This USB wireless mouse features a line-by-line scroll wheel, up to 1 year of battery life (2) thanks to a smart sleep mode function, and comes with the included AA battery
- Universal Compatibility: Your Logitech mouse works with your Windows PC, Mac, or laptop, so no matter what type of computer you own today or buy tomorrow your mouse will be compatible
- Plug and Play Simplicity: Just plug in the tiny nano USB receiver and start working in seconds with a strong, reliable connection to your wireless computer mouse up to 33 feet / 10 m (5)
- Better than touchpad: Get more done by adding M185 to your laptop; according to a recent study, laptop users who chose this mouse over a touchpad were 50% more productive (3) and worked 30% faster (4)
Keep the bytes in memory
const button = page.getByRole('button', { name: 'Save' });
const imageBuffer = await button.screenshot();
// Pass imageBuffer to storage, an image processor, or an HTTP client.
The returned value is a Node.js Buffer. This is useful when a test or service should avoid temporary files.
Choose a reliable locator
Start with:
page.getByRole('button', { name: 'Save' })
If multiple matching buttons exist, narrow the search to a meaningful region:
const dialog = page.getByRole('dialog', { name: 'Account settings' });
await dialog.getByRole('button', { name: 'Save' }).screenshot({ path: 'dialog-save.png' });
You can use a test ID when it is deliberately part of your application’s test contract:
await page.getByTestId('save-button').screenshot({ path: 'button.png' });
Avoid long CSS or XPath chains tied to incidental markup. They tend to break when a layout or wrapper changes. If the control has no usable accessible name, fix the markup where possible rather than weakening every test.
What Playwright does before taking the shot
- Actionability checks: Playwright waits for the locator to resolve to an actionable element.
- Scrolling: the element is scrolled into view before capture.
- Clipping: the output is clipped to the element’s position and size.
- Detachment handling: if a framework rerenders and removes the node while the operation is in progress, the screenshot can fail; locate the element again after the UI settles.
- Coverage remains visible: a cookie banner, modal, or other overlay covering the button is part of the rendered scene. Playwright does not reveal pixels hidden behind it.
For a button inside a scrollable container, the image reflects the container’s current scroll position. Scroll that container first if the control is outside the visible area.
Rank #2
- The next-generation optical HERO sensor delivers incredible performance and up to 10x the power efficiency over previous generations, with 400 IPS precision and up to 12,000 DPI sensitivity
- Ultra-fast LIGHTSPEED wireless technology gives you a lag-free gaming experience, delivering incredible responsiveness and reliability with 1 ms report rate for competition-level performance
- G305 wireless mouse boasts an incredible 250 hours of continuous gameplay on just 1 AA battery; switch to Endurance mode via Logitech G HUB software and extend battery life up to 9 months
- Wireless does not have to mean heavy, G305 lightweight mouse provides high maneuverability coming in at only 3.4 oz thanks to efficient lightweight mechanical design and ultra-efficient battery usage
- The durable, compact design with built-in nano receiver storage makes G305 not just a great portable desktop mouse, but also a great laptop travel companion, use with a gaming laptop and play anywhere
const panel = page.locator('.settings-panel');
await panel.evaluate((el) => el.scrollTop = el.scrollHeight);
await panel.getByRole('button', { name: 'Save' }).screenshot({ path: 'save.png' });
Control output for repeatable images
Disable animation
await saveButton.screenshot({
path: 'button.png',
animations: 'disabled'
});
animations: 'disabled' disables CSS transitions, CSS animations, and Web Animations for the capture. Finite animations are fast-forwarded and infinite ones are canceled for the screenshot, then the page is restored.
CSS pixels or device pixels
await saveButton.screenshot({ path: 'button-css.png', scale: 'css' });
await saveButton.screenshot({ path: 'button-device.png', scale: 'device' });
scale: 'css' produces one output pixel per CSS pixel. scale: 'device‘ uses device pixels and can create a larger image on a high-DPI display. Use the same choice across visual baselines.
Mask changing regions
Mask locators whose content is dynamic or irrelevant to the comparison. Playwright paints the masked regions with an overlay color during capture.
const accountName = page.getByTestId('account-name');
await saveButton.screenshot({
path: 'button.png',
mask: [accountName]
});
Transparent backgrounds and other options
omitBackground: true can preserve transparency for formats that support it; it does not apply to JPEG. The screenshot options also include type, style, and timeout. A timeout should reflect how long your application may need to render, but raising it does not fix a locator that never matches.
Use screenshot assertions for visual regression
If the purpose is a Playwright Test visual check rather than an image artifact, use toHaveScreenshot():
Rank #3
- Compact Mouse: With a comfortable and contoured shape, this Logitech ambidextrous wireless mouse feels great in either right or left hand and is far superior to a touchpad
- Durable and Reliable: This USB wireless mouse features a line-by-line scroll wheel, up to 1 year of battery life (2) thanks to a smart sleep mode function, and comes with the included AA battery
- Universal Compatibility: Your Logitech mouse works with your Windows PC, Mac, or laptop, so no matter what type of computer you own today or buy tomorrow your mouse will be compatible
- Plug and Play Simplicity: Just plug in the tiny nano USB receiver and start working in seconds with a strong, reliable connection to your wireless computer mouse up to 33 feet / 10 m (5)
- Better than touchpad: Get more done by adding M185 to your laptop; according to a recent study, laptop users who chose this mouse over a touchpad were 50% more productive (3) and worked 30% faster (4)
import { expect, test } from '@playwright/test';
test('Save button appearance stays stable', async ({ page }) => {
await page.goto('https://example.com');
await expect(page.getByRole('button', { name: 'Save' }))
.toHaveScreenshot('save-button.png');
});
This assertion is specific to the Playwright Test runner. It takes consecutive screenshots and waits for them to stabilize before comparing with the expected image. Use it for a baseline test; use locator.screenshot() when you need a standalone file or buffer.
Full-page and button captures are different
page.screenshot({ path: 'page.png', fullPage: true }) captures the document, including areas outside the viewport. A locator screenshot remains an element-level capture. Do not substitute a full-page shot when a documentation asset or assertion needs the button’s exact box.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Troubleshooting common failures
“Locator resolved to multiple elements”
Your selector is not unique. Scope it to a dialog, card, navigation region, or another stable ancestor, or use a test ID that identifies the intended control.
“Locator did not resolve” or a timeout
Check the accessible name, spelling, frame, and page state. Wait for the UI operation that creates the button instead of adding an arbitrary delay:
await page.getByRole('button', { name: 'Open settings' }).click();
const saveButton = page.getByRole('button', { name: 'Save' });
await saveButton.waitFor({ state: 'visible' });
await saveButton.screenshot({ path: 'save.png' });
If the button is inside an iframe, obtain the frame locator first:
Rank #4
- Computer mouse for easily navigating a computer interface; click, scroll, and more
- USB-A wired connection; if existing device only supports USB-C, an additional adapter will be required
- High-definition (1000 dpi) optical tracking ensures responsive cursor control for precise tracking and easy text selection
- 3 buttons offer effortless fingertip control
- Plug-and-go ready for instant use
const frame = page.frameLocator('iframe[title="Editor"]');
await frame.getByRole('button', { name: 'Save' }).screenshot({ path: 'save.png' });
“Element is not attached to the DOM”
A rerender replaced the node during capture. Wait for the state that indicates rendering is complete, then create a fresh locator and retry. Avoid retaining an element handle across React/Vue-style rerenders.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →The image includes a popup or cookie banner
That is the actual rendered page. Dismiss the banner through the same user-facing control your test would use, or hide an irrelevant element deliberately with a screenshot style or mask. Do not remove a real obstruction if the test is meant to verify what users see.
The button is partly hidden
Inspect overlays, sticky headers, and clipping containers. Scrolling the page does not necessarily scroll an inner container; scroll the relevant container before capture. A covered portion is not reconstructed by Playwright.
Images differ between machines
Standardize browser version, viewport, device scale factor, fonts, color scheme, and animation state. Choose one scale value, disable animations, and mask data that legitimately changes.
Performance, format, and workflow choices
- Use a path for human-readable artifacts, CI attachments, or documentation checked into a build output directory.
- Use a buffer to avoid disk I/O or to send the image directly to object storage.
- Use PNG for lossless visual comparisons and crisp text.
- Use JPEG or WebP when smaller files matter more than lossless pixels and your downstream system supports the format.
- Capture only the locator to reduce image size and comparison noise compared with full-page captures.
Keep screenshots deterministic by setting the same viewport and browser context options in local runs and continuous integration. If a page is inherently dynamic, a stable assertion may require masking or a state fixture rather than repeated retries.
Recommended Free Tools
Or skip the browser setup: ScreenshotNeo
ScreenshotNeo is a website screenshot API and MCP server for developers. For a button-specific image, you can pass a CSS selector and let the service render the page remotely; this is useful when you do not want to install browsers or maintain Playwright fixtures. Its clean-shot flow accepts cookie and consent banners before removing more than 60 known consent platforms, newsletter popups, and chat widgets, with each step configurable.
The API returns PNG, JPEG, WebP, or PDF. Only clean shots are billed: bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report the page verdict and billing result.
One-call cURL example
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 documentation for authentication, selector options, and response details. The service supports full-page captures with lazy images, element selection by CSS selector, dark mode, 12 device presets plus custom viewports, retina scale, PDF paper settings, custom CSS and JavaScript, pre-capture clicks, hidden selectors, waits for selectors, delays or network idle, ad and tracker blocking, custom headers/cookies/user agents/Authorization, timezone and geolocation, transparent backgrounds, resizing, configurable cache TTL, signed image links, asynchronous webhooks, bulk capture of up to 100 URLs per call, a usage API, and an OpenAPI specification. Parameter names used by other screenshot APIs also work to ease migration.
Best Value
- 【Plug and Play for Home/Office/School】The wireless computer mouse features 2.4GHz connectivity, delivering a stable, interference-free connection up to 32ft. Designed for 𝐦𝐞𝐝𝐢𝐮𝐦 𝐭𝐨 𝐥𝐚𝐫𝐠𝐞 𝐬𝐢𝐳𝐞𝐝 𝐡𝐚𝐧𝐝𝐬, it ensures comfortable use all day. Simply plug in the USB-A receiver for instant pairing—no drivers needed. 📌📌 If the mouse isn’t suitable, place the USB receiver in the battery compartment and return both.
- 【3 Levels Adjustable DPI】This travel USB mouse offers 3 adjustable DPI settings (800, 1200, 1600), allowing you to customize sensitivity for precise design work. Effortlessly switch to match your task and elevate your productivity. 📌 Please remove the film at the bottom of the mouse before use.
- 【Effortless Browsing】Equipped with forward and backward buttons, this computer mice streamlines your workflow, making it easy to navigate through web pages and files with a simple click. 📌Side button does not work on Mac.
- 【Visible Indicator Light】 The pc mouse features a visual indicator for DPI levels and low battery alerts. The red light flashes once for 800 DPI, twice for 1200 DPI, and three times for 1600 DPI. When the battery level is below 10%, the light flashes red until the mouse is completely out of power.
- 【Click to Wake】With smart sleep mode, it saves power by standby after 10 inactive minutes, just 2-3 clicks to wake. This efficient design delivers 3x longer battery life than motion-wake mice. Engineered for durability, its buttons and scroll wheel are tested for 10 million clicks, ensuring long-term reliability and consistent performance.
Python
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
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}`);
ScreenshotNeo also provides an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. Plans include 1,000 shots per month free with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account to try it.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Frequently Asked Questions
Can I screenshot a button before clicking it?
Yes. Locate it and call screenshot() before any click. To capture a post-click state, perform the click, wait for the state change, then take a fresh locator screenshot.
Does a locator screenshot include the button’s shadow DOM?
It captures the rendered pixels within the element’s box. Locator matching and accessible-name behavior still depend on how the component exposes its semantics.
Should I use ElementHandle.screenshot()?
Prefer locator-based APIs. Locators re-resolve against the current DOM and align with Playwright’s recommended locator strategy, while retained handles are more vulnerable to rerender detachment.
Why is my screenshot size different on CI?
Device scale factor, browser version, fonts, viewport, and operating-system rendering can change dimensions or pixels. Standardize those settings and choose a consistent scale.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsQuick 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.




