Outdated 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 matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Playwright Codegen records browser interactions and generates a test; it does not automatically add screenshot steps. Start Codegen, record the page state you want, copy its generated test into your project, then add page.screenshot() or a locator screenshot where the capture belongs. Use fullPage: true for the full scrollable page and fix your browser settings and dynamic content when you need repeatable visual-regression images.
What Codegen does—and what it does not
Playwright’s test generator records actions as you interact with a site and helps you get started with a test. The official Codegen guide describes it as a way to generate tests from browser activity. Codegen generates navigation and interaction steps; add screenshot calls to the generated test yourself, at the point where the page has reached the state you want to capture.
That distinction matters: the screenshot reflects the page after the actions and waits that precede it. If you record a click that opens a menu, place the screenshot after that click. If the image is captured too early, add an explicit wait for a meaningful page condition rather than relying on an arbitrary delay.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Record a test with Playwright Codegen
- Install Playwright in a project. If you have not already set up a Playwright Test project, follow the official installation guide. The examples below use the Playwright Test runner and TypeScript.
- Start Codegen from the project directory:
npx playwright codegen https://example.com - Interact with the site. Codegen opens a browser window and shows generated actions in Playwright Inspector. Navigate and perform the interactions needed to reach the state you want to test.
- Copy the generated test. Stop recording and move the generated code into your project’s test file. Review it and make sure it describes the intended state rather than merely preserving every exploratory action.
- Add a screenshot call at the right point. Save a file by providing a
path, or omit the path to receive an in-memory buffer.
The Codegen command accepts options in the form npx playwright codegen [options] [url]. It supports browser selection, output-file selection, and language targets including Python; see the CLI reference for options supported by your installed Playwright version.
#1 Best Overall
Useful recording options
--viewport-size="800,600"opens a fixed viewport, useful when the page layout depends on the window dimensions.--device="iPhone 13"emulates a named device for a mobile-oriented recording. Use a device name supported by your Playwright installation.--color-scheme=dark,--timezone="America/New_York",--geolocation="41.889938,12.492507", and--lang="en-US"can set environmental inputs that affect the rendered page. Check the CLI reference for exact option spelling and availability in your installed release.--save-storage=auth.jsonsaves browser storage state;--load-storage=auth.jsonloads it for a later session. Storage state can contain authentication material. Keep it local, do not commit it, and avoid sharing it.
For example, a fixed-size recording can be started with npx playwright codegen --viewport-size="800,600" https://example.com. Codegen’s generated test is a starting point, not a substitute for checking the screenshot behavior in the test runner.
Add viewport, full-page, or element screenshots
After copying the generated actions into a test, insert the screenshot call after the page has reached the state you need. This complete example writes three image files:
import { test } from '@playwright/test';
test('capture page states', async ({ page }) => {
await page.goto('https://example.com');
await page.screenshot({ path: 'artifacts/viewport.png' });
await page.screenshot({ path: 'artifacts/full-page.png', fullPage: true });
await page.getByRole('banner').screenshot({
path: 'artifacts/banner.png',
animations: 'disabled',
});
});
Playwright can save PNG, JPEG, or WebP when you set a path with a matching extension. Its screenshot API also returns a buffer when no path is supplied. See the official screenshot guide and page screenshot API reference for current option details.
Capture the current viewport
await page.screenshot({ path: 'artifacts/viewport.png' }) captures the visible viewport. It is usually the right choice for a screenshot of a modal, current interaction, or above-the-fold state. Confirm the viewport dimensions before comparing images: a different viewport can change line wrapping, breakpoints, and the visible content.
Rank #2
Capture the entire scrollable page
await page.screenshot({ path: 'artifacts/full-page.png', fullPage: true }) captures the full page rather than only what is currently visible. The resulting image may be much taller than the viewport. Full-page output is useful for a page overview, but very long pages can create large files and may expose content far below the initial view that your test did not otherwise inspect. Some sites load content only as you scroll; make sure lazy-loaded images and sections have actually appeared before treating the capture as complete.
Capture one element
Use a locator’s screenshot method for a component, such as a banner, card, or menu: await page.getByRole('banner').screenshot({ path: 'artifacts/banner.png' }). A locator screenshot waits for actionability and scrolls the target into view before capturing it. Prefer a stable locator that identifies the intended element uniquely. If the selector matches nothing or more than one element, refine it using a role, accessible name, or CSS selector that identifies the component.
For moving content, add animations: 'disabled' to the locator screenshot options. This stops CSS and Web Animations for the capture and can reduce differences caused by motion. It does not make changing data, random content, or time-dependent text deterministic.
Free tools Windows power users keep installed
One-click scans. No signup required.
Keep the screenshot in memory
When you need to pass an image to another function or a pixel-diff tool instead of writing a file, omit path:
const buffer = await page.screenshot();
// Pass buffer to your image comparison or post-processing code.
This avoids an intermediate file, but the buffer still consumes memory. For visual regression, compare images only after controlling viewport, browser environment, page state, and dynamic regions. A downstream pixel-diff service is optional; Playwright itself supplies the screenshot bytes, not a particular comparison service.
Make screenshots reproducible
Visual differences are not always application regressions. They can come from different viewport sizes, device emulation, locale, time zone, authentication state, animations, or content that changes between runs. Make those inputs explicit before using screenshots as a comparison baseline.
Fix the browser environment
- Viewport or device: use the same viewport dimensions on each run, or select the same named device when mobile rendering is what you are checking.
- Color scheme, language, time zone, and location: set these when the page’s styling, dates, text, or location-sensitive content depends on them. Keep the values consistent across baseline and comparison runs.
- Authentication: use the same storage state when a page requires a logged-in session. Treat saved state as a secret because it can include cookies or other credentials.
- Page readiness: wait for a stable, relevant condition before capturing. For example, wait for the heading or component you expect rather than assuming that navigation alone means every client-rendered section has finished.
Control unstable pixels
Use screenshot masks to cover dynamic or private regions that are not part of the visual change you want to detect. Masking is especially useful for timestamps, avatars, account details, or frequently changing promotional content. Do not mask a region if changes in it are part of the behavior under test.
Recommended Free Tools
scale: 'css' requests output dimensions based on CSS pixels, which can help avoid device-pixel-ratio differences when comparing captures. Use omitBackground: true when transparent output is required. Check the current screenshot API options for the accepted types and behavior in your installed version.
Choose the right capture scope and output
| Need | Use | What it captures |
|---|---|---|
| Current visible state | page.screenshot({ path }) |
The viewport at the time of capture. |
| All scrollable content | page.screenshot({ path, fullPage: true }) |
A full-page image, potentially much taller than the viewport. |
| One component | locator.screenshot({ path }) |
The matched element, brought into view as needed. |
| Post-processing or pixel comparison | await page.screenshot() |
An image buffer rather than a file written by Playwright. |
Pick the narrowest scope that answers the test question. A component screenshot usually creates less irrelevant visual noise than a whole-page capture; a full-page image is appropriate when below-the-fold layout is itself important.
Rank #4
Python Codegen and screenshot workflow
Codegen can generate Python as well as JavaScript or TypeScript. Select a Python target using the CLI option supported by your installed version, for example npx playwright codegen --target=python https://example.com. The exact generated format depends on the target and Playwright release. Once the recording is copied into a Python Playwright test, add a screenshot at the desired point:
import re
from playwright.sync_api import Page, expect
def test_capture_page(page: Page) -> None:
page.goto("https://example.com")
page.screenshot(path="artifacts/viewport.png")
page.screenshot(path="artifacts/full-page.png", full_page=True)
page.get_by_role("banner").screenshot(
path="artifacts/banner.png",
animations="disabled",
)
Python uses full_page=True rather than the JavaScript API’s fullPage: true. Use the parameter spellings and test-runner conventions for your installed Playwright Python package; consult the Python screenshot guide and Python Codegen guide.
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 errorsOr skip the browser setup
If you need an image or PDF without writing and maintaining a browser test, ScreenshotNeo provides a website screenshot API and MCP server. Its GET endpoint accepts a URL and returns PNG, JPEG, WebP, or PDF. Here is the 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 API documentation for authentication and request options. Cookie banners are accepted like a visitor and more than 60 known consent platforms, newsletter popups, and chat widgets are removed before capture; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its 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 shots. Sign up for 1,000 free screenshots a month with no card.
Troubleshoot common screenshot problems
The screenshot file is missing
Check that the test reached the screenshot call and that the output directory exists or can be created by your project setup. A relative path such as artifacts/viewport.png is resolved from the test process’s working directory. Create the directory before the test if your runner does not create it automatically, and inspect the test result for an earlier navigation or assertion failure.
The screenshot is blank or captures the wrong state
The call may run before the page or component is ready, or the interactions copied from Codegen may not reach the state you intended. Add an assertion or wait for the relevant locator, then capture after the action that reveals the state. Avoid treating a fixed sleep as proof of readiness: network and rendering time can vary between runs.
The full-page image is unexpectedly tall or incomplete
fullPage: true includes the scrollable page, so long content naturally produces a tall image. For lazy-loaded content, scroll through the page or otherwise trigger the content before capture, then verify the sections and images are present. If the test only concerns the initial view, use a viewport screenshot instead.
The element screenshot fails
Confirm that the locator resolves to the intended element and is visible and actionable. If the element appears only after an interaction, perform that action first and wait for the element. If multiple elements match, make the locator more specific.
Images differ on every run
Fix the viewport and emulation inputs, disable animations for the relevant capture, and mask genuinely irrelevant dynamic regions. Also check whether the page contains changing data, rotating content, or a different authentication state. Do not mask away parts of the interface whose changes the test is supposed to detect.
Codegen option or generated syntax is rejected
CLI flags and API options may vary by Playwright release. Check npx playwright --version, then compare the command with the current CLI reference and use the API reference corresponding to the version installed in your project. Codegen’s Python and JavaScript targets use language-specific naming and syntax.
Performance, reliability, and maintenance
Screenshots add work to a test: full-page captures can be large, and saving or comparing many images can increase disk use and CI time. Capture only the views that answer a test question. Use element captures for component-level checks and viewport captures for focused states; reserve full-page capture for tests that need the entire layout.
For a stable suite, keep browser versions and emulation settings consistent between baseline creation and later runs. Review updates to the Playwright API when upgrading because option availability and defaults can change by release. Store screenshot artifacts intentionally: they may contain private account data, and authentication storage files should be protected separately. A buffer is convenient for downstream processing, but it still has a memory cost; writing a file is often simpler when the artifact needs inspection or retention.
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.

