Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk8 min

Playwright: A Guide to Browser Automation and Screenshots

A practical Playwright guide to matching browser binaries, capturing screenshots, setting up visual comparisons, and debugging failures with traces.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Playwright automates Chromium, Firefox and WebKit, and its Page API can save viewport, full-page or element screenshots. Install the browser binaries that match your installed Playwright version, then use Playwright Test when you need repeatable visual baselines or CI failure traces—not just a one-off image.

How Playwright and its browsers fit together

The Playwright package controls browser instances, but it does not simply use whichever browser happens to be installed on your computer. Each Playwright version expects specific browser binaries; its CLI installs compatible builds. Those downloaded builds are distinct from your everyday Chrome, Edge or other browser installation.

As an Amazon Associate I earn from qualifying purchases.

Playwright supports Chromium, Firefox and WebKit. Its browser documentation also covers branded browsers and device emulation. Choose an engine according to the behavior you need to test, and keep the Playwright package and downloaded browser versions aligned. Browser support, options and binaries can change with releases, so check the documentation for your installed version rather than assuming a particular build is current.

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

Install Playwright and the matching browser binaries

For a JavaScript project, install Playwright and then install the browser binaries through its CLI:

#1 Best Overall
Sale
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black
  • 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
npm install -D playwright
npx playwright install

The install command can target an individual engine when you do not need all three:

npx playwright install chromium
npx playwright install firefox
npx playwright install webkit

Use the command for the engine or engines your project actually runs. On CI or a fresh Linux machine, browser installation may also require operating-system dependencies; Playwright’s CLI and browser documentation describe installing those dependencies for supported systems. After upgrading Playwright, rerun the browser installation command if the expected binaries are missing or have changed.

Take a screenshot with the Page API

Once a browser page has navigated to its target, call page.screenshot(). This runnable Node.js example launches Chromium, captures a page and closes the browser even if navigation or capture fails:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch();
  try {
    const page = await browser.newPage({ viewport: { width: 1365, height: 900 } });
    await page.goto('https://example.com', { waitUntil: 'load' });
    await page.screenshot({ path: 'screenshot.png' });
  } finally {
    await browser.close();
  }
})();

Save this as screenshot.js and run node screenshot.js. The example assumes Playwright and its Chromium binary have been installed as above. Use a URL you are authorized to access; pages behind authentication may require a saved or explicitly configured browser context.

Rank #2
Sale
Logitech C270 720p Webcam Plug-and-Play Wide Screen Video Calling - Black
  • 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.

Viewport, full-page and element captures

  • Viewport: page.screenshot({ path: 'screenshot.png' }) captures the current visible page area.
  • Full page: page.screenshot({ path: 'full-page.png', fullPage: true }) captures the full scrollable page rather than only the viewport.
  • One element: use a locator’s screenshot method, for example await page.locator('main').screenshot({ path: 'main.png' }). Replace main with a selector that identifies the element you need.
  • Image data: omit the path option to receive screenshot data as a buffer, which you can pass to another library or write yourself.

Screenshot options vary across Playwright releases. Consult the API documentation corresponding to the version installed in your project before relying on less common options or exact option behavior.

Wait for the page state you need

A screenshot is only as useful as the page state captured. The example waits for the page’s load event; an application that renders content afterward may need an explicit wait for a selector or other application-specific readiness signal before capture. Avoid adding arbitrary delays as a substitute for knowing what “ready” means for the page: a fixed delay can be too short on a slow run and waste time on a fast one.

For long pages, full-page capture is convenient, but it is not equivalent to a sequence of independent viewport captures. If your application loads content only as the user scrolls, verify that the content you expect is present before treating the resulting image as complete.

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

Use screenshot comparisons for visual regression

For ongoing visual checks, Playwright Test provides toHaveScreenshot(). On its first run, it creates a reference image; later runs compare the rendered page against that baseline. A minimal test looks like this:

Rank #3
Sale
NexiGo N60 1080P Webcam with Microphone, Software Control & Privacy Cover, USB HD Computer Web Camera, Plug and Play, for Zoom/Skype/Teams, Conferencing and Video Calling
  • 【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.
const { test, expect } = require('@playwright/test');

test('home page visual baseline', async ({ page }) => {
  await page.goto('https://example.com');
  await expect(page).toHaveScreenshot();
});

This example uses Playwright Test, which is a separate package from the lower-level playwright package used in the earlier script. In a project using Playwright Test, install it and its browsers with:

npm install -D @playwright/test
npx playwright install

Save the test in a file such as tests/home.spec.js, then run npx playwright test. The first run establishes the baseline; subsequent runs compare against the stored reference. Review an intentional change before updating a baseline so a real regression is not silently accepted.

Keep baseline and comparison environments consistent

Visual output can vary with the host operating system, browser version, browser settings, hardware, power source, headless mode and other environmental factors. Create and compare baselines in a controlled, consistent environment—especially in CI. A difference does not automatically mean the application changed; first check whether the environment, fonts, browser build or rendering settings changed.

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

Debug failed browser tests with traces

When a test fails in CI, a trace can show what happened before the failure. Playwright’s CI guidance describes recording a trace on the first retry, a practical balance between having diagnostic evidence and recording less data than tracing every passing test. Configure tracing through Playwright Test when you want test-aware failure traces.

Rank #4
Sale
EMEET C960 1080P Webcam with Microphone, 2 Mics, 90° FOV, Computer Camera | USB Type-A & A-to-C Adapter, Fixed Focus, Plug&Play for Zoom/Teams/Facetime/YouTube/Google Meet/Switch 2 Camera, 2025 Version
  • 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)

The Trace Viewer can expose an action timeline, DOM snapshots, source locations, console and network activity, metadata and attachments. Those details help distinguish a navigation problem, an unexpected page state, a failed request and a test assertion problem.

Know the low-level tracing boundary

The lower-level context.tracing API records browser operations and network activity, but it does not record Playwright Test assertions. For fuller traces that include test failure context, use Playwright Test’s tracing configuration rather than assuming the context API captures assertions. Recording traces for every test can add performance and storage overhead, so use a policy appropriate to your debugging needs.

Choose the right capture workflow

Need Use What it gives you
A one-off image of what a page currently shows page.screenshot() A saved image or buffer for further processing.
An image of a long, scrollable page page.screenshot({ fullPage: true }) A full-page capture rather than only the visible viewport.
A screenshot of one component A locator’s screenshot() method An image targeted to the selected element.
Ongoing visual regression checks Playwright Test’s toHaveScreenshot() A managed baseline on the first run and comparisons on later runs.
Evidence to diagnose a failed test Playwright Test tracing Trace Viewer inspection of the test’s actions and related browser activity.

Playwright is a good fit when the screenshot is one part of browser automation, application testing or a controlled visual-regression workflow. A test-managed baseline is different from a standalone image: it adds comparison and review responsibilities, and its usefulness depends on a stable capture environment.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If you need a screenshot from a URL without managing browser binaries or writing capture automation, ScreenshotNeo offers a website screenshot API and MCP server. Its one-call API can return a PNG, JPEG, WebP or PDF. This cURL example saves a WebP screenshot of the supplied page:

Best Value
Logitech C920x HD Pro PC Webcam Full 1080p/30fps Video - Black
  • Compatible with Nintendo Switch 2’s new GameChat mode
  • HD lighting adjustment and autofocus: The Logitech webcam automatically fine-tunes the lighting, producing bright, razor-sharp images even in low-light settings. This makes it a great webcam for streaming and an ideal web camera for laptop use
  • Advanced capture software: Easily create and share video content with this Logitech camera that is suitable for use as a desktop computer camera or a monitor webcam
  • Stereo audio with dual mics: Capture natural sound during calls and recorded videos with this 1080p webcam, great as a video conference camera or a computer webcam
  • Full HD 1080p video calling and recording at 30 fps. You'll make a strong impression with this PC webcam that features crisp, clearly detailed, and vibrantly colored video
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Replace YOUR_API_KEY with your API key and change the target URL as needed. See the ScreenshotNeo API documentation for request parameters. Cookie and consent banners are accepted or removed before capture; the cleanup steps can be disabled individually. Known newsletter popups and chat widgets are also removed. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and response headers report 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 with no card required; paid plans start at $5 for 3,000 screenshots. Sign up for ScreenshotNeo and start with 1,000 free screenshots a month, no card required.

Troubleshooting common failures

Playwright cannot find a browser executable

Likely cause: the browser binary for the installed Playwright version has not been installed, or the package was upgraded after installation. Fix: run npx playwright install, or install the needed engine explicitly, then retry. In CI, make sure the browser install step runs for the same project dependency version used by the test.

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

Browser launch fails on a CI or Linux machine

Likely cause: required operating-system dependencies are missing, or the environment does not support the selected browser setup. Fix: consult Playwright’s browser installation guidance for your operating system and install the required system dependencies as part of environment setup. Do not treat the browser binary install and OS dependency install as interchangeable steps.

The screenshot is blank or misses expected content

Likely cause: the capture happened before application content was rendered, or the page requires authentication or additional setup. Fix: wait for a meaningful page or element readiness condition, and configure the appropriate browser context for authorized access. If the page loads content on scroll, verify that the relevant content has actually loaded before capture.

A visual comparison fails after no deliberate UI change

Likely cause: the comparison environment changed, including the browser build, operating system, settings, hardware or headless mode. Fix: align the baseline and comparison environments and inspect the diff before updating the baseline. Update it only when the visual change is intended.

A trace does not show an assertion

Likely cause: tracing was started with the low-level context API, which does not capture test assertions. Fix: configure tracing through Playwright Test when you need the test’s failure context alongside browser activity.

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

Quick Recap

SaleBestseller No. 1
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black
Compatible with Nintendo Switch 2’s new GameChat mode; Built-In Mic: The built-in microphone lets others hear you clearly during video calls
$35.80
SaleBestseller No. 2
Logitech C270 720p Webcam Plug-and-Play Wide Screen Video Calling - Black
Logitech C270 720p Webcam Plug-and-Play Wide Screen Video Calling - Black
Compatible with Nintendo Switch 2’s new GameChat mode
$16.89
Bestseller No. 5
Logitech C920x HD Pro PC Webcam Full 1080p/30fps Video - Black
Logitech C920x HD Pro PC Webcam Full 1080p/30fps Video - Black
Compatible with Nintendo Switch 2’s new GameChat mode; Fully compatible with Windows 11
$69.99

Performance, reliability and cost considerations

  • Browser setup: downloading and maintaining compatible browser binaries is part of the Playwright workflow. In CI, cache or install them in a way that remains aligned with the package version.
  • Capture readiness: explicit readiness conditions are usually more reliable than arbitrary delays because they wait for the content your screenshot actually needs.
  • Visual stability: environment consistency matters as much as the test assertion. A different OS or browser build can change pixels independently of an application change.
  • Trace volume: traces are valuable for diagnosing failures, but recording on every test can be performance-heavy. A retry-focused policy can retain useful failure evidence without capturing every run.
  • Cost: Playwright is an automation library and local browser workflow; the documentation reviewed does not establish a universal operating cost or performance figure. Your infrastructure, CI usage and browser storage choices determine the operational cost.

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
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.