ScreenshotNeo

BlogComparisons

Chrome DevTools Screenshot vs Playwright Screenshot: Key Differences

Use DevTools for quick manual captures and Playwright for repeatable, scriptable screenshots. Compare capture scope, options, setup, and visual testing.

By the ScreenshotNeo team4 October 20269 min read

Short answer: Use Chrome DevTools to capture the page you are inspecting by hand. Use Playwright when screenshots need to run repeatedly in code, target a specific element or region, feed a pipeline, or support visual regression tests. DevTools has viewport and full-page capture commands; Playwright supports those workflows plus configurable capture options and automation. The two can produce different pixels unless you align the browser, viewport, scale, page state, and execution environment.

1. What differs between DevTools and Playwright?

Need Chrome DevTools Playwright
Quick manual capture Capture the visible viewport from the Command Menu. Requires a script or test.
Entire page Choose “Capture a full size screenshot.” Set fullPage: true; it is false by default.
Specific region or element The Device Mode guide documents viewport and full-size capture. Lower-level DevTools Protocol exposes clipping. Use clip for a rectangle or a locator’s screenshot method for an element.
Repeatable automation The documented workflow is an interactive menu action. Call the screenshot API from a script or test and save a file or use returned bytes.
Visual regression Convenient for inspecting a page, but the cited capture guide does not describe a baseline testing workflow. Playwright Test can create reference screenshots and compare later runs.
Mobile view Device Mode simulates a device from a desktop or laptop; it is an approximation. Configure the browser context’s viewport and device scale factor. This still does not run on a physical handset.

This compares the workflows described in the linked documentation; it does not establish that DevTools has no other screenshot capabilities.

2. Capture a screenshot with Chrome DevTools

  1. Open the page in Chrome and bring it to the state you want to capture. Dismiss or complete dialogs as needed, wait for content and animations to settle, and set the desired viewport.
  2. Open DevTools. To emulate a mobile viewport, turn on the device toolbar and choose or configure the device dimensions. Device Mode can also emulate network and CPU conditions.
  3. Open the DevTools Command Menu with Ctrl+Shift+P on Windows/Linux or Command+Shift+P on macOS.
  4. Choose Capture screenshot for the visible viewport, or Capture full size screenshot for the full page. Chrome saves the image through its normal download flow.
  5. If you want a device frame in the result, enable Show device frame before capturing in a device-specific mode.

The exact menu labels can vary between Chrome versions. Use the Command Menu search for “screenshot” if the command is not immediately visible. Chrome describes Device Mode as a “first-order approximation” of a mobile experience: code is simulated on the desktop or laptop, not run on the emulated physical device. See Chrome’s Device Mode guide.

3. Capture screenshots with Playwright

Playwright is the better fit when capture must be repeatable. The examples below use Chromium and a public example URL. Install the package and browser once, then run the script. Replace the target URL and output path as needed.

JavaScript: viewport and full-page screenshots

npm install -D playwright
npx playwright install chromium
// screenshot.mjs
import { chromium } from 'playwright';

const browser = await chromium.launch({ headless: true });
const page = await browser.newPage({
  viewport: { width: 1440, height: 900 },
  deviceScaleFactor: 1,
});

try {
  await page.goto('https://example.com', { waitUntil: 'networkidle' });
  await page.screenshot({ path: 'viewport.png' });
  await page.screenshot({ path: 'full-page.png', fullPage: true });
} finally {
  await browser.close();
}

Run with node screenshot.mjs. For applications that keep polling or streaming, networkidle may never be reached; use domcontentloaded or load and explicitly wait for the page state you need.

JavaScript: capture an element or clipped region

import { chromium } from 'playwright';

const browser = await chromium.launch({ headless: true });
const page = await browser.newPage({ viewport: { width: 1280, height: 800 } });

try {
  await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
  await page.locator('h1').screenshot({ path: 'heading.png' });
  await page.screenshot({
    path: 'region.png',
    clip: { x: 0, y: 0, width: 640, height: 400 },
  });
} finally {
  await browser.close();
}

A locator screenshot captures the selected element after Playwright scrolls it into view. A clip is a page-coordinate rectangle. If the target may appear late, wait for it explicitly, for example await page.locator('.report').waitFor({ state: 'visible' }).

Python: viewport and full-page screenshots

python -m pip install playwright
python -m playwright install chromium
# screenshot.py
from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch(headless=True)
    page = browser.new_page(
        viewport={"width": 1440, "height": 900},
        device_scale_factor=1,
    )
    try:
        page.goto("https://example.com", wait_until="networkidle")
        page.screenshot(path="viewport.png")
        page.screenshot(path="full-page.png", full_page=True)
    finally:
        browser.close()

Run with python screenshot.py. The synchronous API is used for a compact script; Playwright also provides an asynchronous Python API.

Python: element and clipped-region screenshots

from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch()
    page = browser.new_page(viewport={"width": 1280, "height": 800})
    try:
        page.goto("https://example.com", wait_until="domcontentloaded")
        page.locator("h1").screenshot(path="heading.png")
        page.screenshot(
            path="region.png",
            clip={"x": 0, "y": 0, "width": 640, "height": 400},
        )
    finally:
        browser.close()

4. Choose the right capture scope and options

Viewport versus full page

DevTools’ viewport command captures what is visible; its full-size command captures content beyond the viewport. In Playwright, fullPage defaults to false. Set it to true when you need the full document. Full-page output can be very tall and consume substantial memory, so use a viewport or element capture when that is sufficient.

Region versus element

Playwright’s clip option is useful for a fixed rectangle. Locator screenshots are usually more resilient when the target is a component whose position changes with content. Prefer a stable selector, wait until it is visible, and make sure overlays do not cover the target. The Chrome DevTools Protocol separately documents Page.captureScreenshot clipping and capture beyond the viewport; that is a lower-level protocol interface rather than the simple menu workflow.

Format, quality, and scale

Playwright can write PNG, JPEG, or WebP output based on the path/format options supported by the API. JPEG quality applies to JPEG output. Its scale option accepts css (one image pixel per CSS pixel) or device (one image pixel per device pixel); device scale is the default and can make captures larger on high-DPI settings. Choose one scale deliberately if dimensions are part of a downstream contract.

Masking, transparency, and animations

Playwright supports masking locators, omitting the default background for transparency, and controlling animations. The documented defaults include omitBackground: false and animations: 'allow'. For stable comparisons, mask timestamps or user-specific values, disable or wait out motion where appropriate, and choose whether transparent output is actually required. Consult the Page screenshot API reference for current option names and types.

Mobile emulation and device scale

Both workflows can show a mobile-sized layout, but a desktop simulation is not a physical-device test. Align viewport dimensions and device pixel ratio when comparing captures. Device frames are presentation around a capture; they do not make the underlying rendering equivalent to a handset.

5. Make captures comparable and repeatable

  1. Pin the browser engine and version. Chromium, Firefox, and WebKit can render differently, and browser updates can change pixels.
  2. Set the viewport and device scale factor. Record width, height, and scale rather than relying on machine defaults.
  3. Control page state. Use a stable test account and data, wait for the relevant element, and handle cookie dialogs, fonts, images, and animations consistently.
  4. Use the same execution environment. Keep OS/container image, browser build, headless mode, and relevant settings aligned between baseline creation and comparison.
  5. Review diffs with tolerances that fit the page. Antialiasing, font rasterization, and dynamic content can create small differences that are not functional regressions.

Playwright’s visual comparison documentation warns that host OS, browser version, settings, hardware, power source, and headless mode can affect rendering. Its guidance is to run comparisons in the same environment as the baseline. Matching DevTools and Playwright output likewise requires aligning their browser, viewport, scale, page state, and environment; identical output across different setups should not be assumed. See Playwright visual comparisons.

6. When should you use each?

  • Use DevTools for a one-off capture while debugging, sharing a visual state, or checking a responsive layout interactively.
  • Use Playwright for scheduled or repeatable captures, element screenshots, pipeline processing, and visual regression tests.
  • Use a real device when validating physical-device behavior such as hardware, browser integration, or actual handset rendering. Device Mode is a simulation.
  • Use a screenshot API when you need captures without installing and operating a browser in your own environment.

7. Or skip the browser setup

For a hosted capture, ScreenshotNeo takes a URL in one GET request and returns an image or PDF. The parameter names used by other screenshot APIs also work, which can make switching easier. See the ScreenshotNeo website and API documentation.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
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)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot request failed: ${res.status}`);
await import('node:fs/promises').then(fs => fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer())));

Cookie and consent banners, newsletter popups, and chat widgets are removed before the shot, and each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing; response headers report the page verdict and billing status. An MCP server lets AI agents, including Claude and Cursor, take screenshots. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots. Sign up for 1,000 free screenshots a month, with no card.

8. Troubleshooting

Symptom Likely cause Fix
Playwright says the browser executable is missing The package is installed but its browser binary is not. Install the matching browser with npx playwright install chromium or python -m playwright install chromium.
Capture is blank or incomplete The screenshot ran before client rendering, fonts, or images finished. Wait for the target locator or a page-specific ready condition. Avoid assuming that a fixed delay works for every run.
networkidle hangs or times out Long polling, analytics, or streaming keeps network activity alive. Use domcontentloaded or load, then wait for the content you need.
Element screenshot times out The selector is wrong, hidden, or never appears. Check the selector and page state; wait for visibility and inspect whether the element is inside a frame or shadow root.
Full-page capture is unexpectedly huge The document is long, or device scale produces more pixels than expected. Use viewport/element capture, choose CSS scale where suitable, or capture sections separately.
Visual test fails on CI but passes locally Browser, OS, fonts, headless mode, or rendering environment differs. Run baseline and comparison in the same pinned environment and stabilize dynamic content.
DevTools command is hard to find Menu labels or placement differ by Chrome version. Open the Command Menu and search “Capture screenshot.”
Mobile result differs from a phone Device Mode approximates mobile behavior on desktop hardware. Validate handset-specific behavior on the actual device or a physical-device test setup.

9. Performance, reliability, and cost

DevTools has almost no setup cost for an occasional manual image: it uses the open browser session and requires a person to initiate each capture. Playwright adds installation and browser execution overhead, but makes repeated work scriptable and reduces manual steps. Full-page and device-scale screenshots can use more memory and storage than viewport captures. For reliability, wait on a meaningful page condition, keep browser versions controlled, and avoid treating a fixed sleep as proof that a page is ready.

For a self-hosted Playwright workflow, account for the engineering time and compute needed to run browsers and retain artifacts; the cited Playwright documentation does not give a universal cost benchmark. DevTools and Playwright are software workflows, with no special capture hardware required for the documented use cases. ScreenshotNeo offers a free monthly tier and published paid tiers; only clean shots are billed under the stated product rules. Check its documentation and current account plan for request configuration.

10. Frequently asked questions

Can Playwright take a screenshot without saving a file?

Yes. The screenshot API can return image bytes or a buffer, which can be passed to another step in your application. Use a path when you want a file artifact.

Does a full-page screenshot include content that loads only while scrolling?

Playwright’s full-page option captures the full page, but lazy-loaded content may need to be triggered or awaited first. Scroll through relevant sections or otherwise cause the site to load them before capturing.

Can I use DevTools screenshots for visual regression tests?

You can save manual reference images, but Playwright Test provides a documented baseline creation and comparison workflow designed for automated runs.

Will DevTools and Playwright produce pixel-identical images?

Not reliably across different browser versions, scale settings, page states, or machines. Align those conditions and use a consistent environment when the comparison matters.

Sources