October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk6 min

How to Take Playwright Screenshots in GitHub Actions

Capture screenshots in Playwright tests, install browsers in CI, upload the right directories as artifacts, and use traces when an image alone cannot explain a failure.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Playwright’s screenshot APIs inside your tests, then upload the directory containing those images as a GitHub Actions artifact. The workflow must install the project’s dependencies and compatible Playwright browsers; if a test fails, configure artifact upload to run unless the workflow is cancelled so you can retrieve the failure output.

Capture a page, full page, or element in Playwright

Call page.screenshot() after navigating to the page state you want to preserve. Create the output directory before the test, or use a path whose parent directory already exists.

import { test } from '@playwright/test';
import { mkdir } from 'node:fs/promises';

test('captures page screenshots', async ({ page }) => {
  await mkdir('artifacts', { recursive: true });
  await page.goto('https://example.com');

  await page.screenshot({ path: 'artifacts/home.png' });
  await page.screenshot({ path: 'artifacts/full-page.png', fullPage: true });
  await page.locator('header').screenshot({ path: 'artifacts/header.png' });
});
  • page.screenshot({ path }) saves the visible page state to a file.
  • fullPage: true captures the full scrollable page in a tall image.
  • locator(selector).screenshot() limits the image to a particular element.

If you omit path, the screenshot API returns an image buffer. That is useful when you want to post-process the image or pass it to another comparison tool instead of writing it directly to disk. Check the Playwright screenshot guide and the Page API reference for the option set supported by the version installed in your project.

Configure GitHub Actions to run the tests and retain the images

This workflow installs the Node dependencies, Playwright browsers and Linux dependencies, runs the suite, and uploads both the screenshots and the HTML report. Adjust the Node version and artifact paths to match the repository. The action major versions shown are examples from Playwright’s live CI documentation; check that they are still appropriate for your project.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
HP OmniBook 3 17.3 inch Laptop PC, FHD Display, AMD Ryzen 3 30, 8 GB RAM, 512 GB SSD, AMD Radeon 610M Graphics, Windows 11 Home, Mica Silver, 17-dp0199nr
  • FULL HD IPS DISPLAY - Enjoy vibrant, crystal-clear images with 178-degree wide-viewing angles
  • AMD RYZEN 3 30 PROCESSOR - Everyday performance you can count on; Multitask, stream, game casually, and edit photos smoothly with responsive power and vibrant HDR visuals
  • ENJOY UP TO 14 HOURS AND 15 MINUTES OF BATTERY LIFE - HP Fast Charge restores battery from 0 to 50% in approximately 45 minutes
  • AMD RADEON 610M GRAPHICS - Experience smooth entertainment; Built for streaming and multitasking, enjoy realistic visuals and efficient performance for work and play
  • STORAGE AND MEMORY - 512 GB PCIe NVMe M.2 SSD offers fast speed and efficient storage; and 8 GB LPDDR5 RAM memory boosts performance with higher bandwidth
name: Playwright screenshots
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-node@v6
        with:
          node-version: lts/*
      - run: npm ci
      - run: npx playwright install --with-deps
      - run: npx playwright test
      - uses: actions/upload-artifact@v5
        if: ${{ !cancelled() }}
        with:
          name: playwright-output
          path: |
            artifacts/
            playwright-report/
          retention-days: 30
  1. Commit the test and workflow. The screenshot test writes image files under artifacts/; the upload step must name that same directory.
  2. Open the workflow run. In GitHub, select the run under the repository’s Actions tab.
  3. Download the artifact. Find playwright-output on the run summary and download it. The archive contains the configured output paths if those directories were created.

The sample also uploads playwright-report/, which is where Playwright’s HTML report is commonly written when configured for it. Uploading a report does not automatically include arbitrary screenshot files; include every output directory you want to keep. GitHub’s Playwright CI guide shows the overall install, run, and artifact pattern.

Choose the right capture for the job

Capture a page state

Use a regular page screenshot when you need to inspect what the browser displayed at a particular point in a test. Navigate and perform any required interactions before calling the screenshot method.

Capture a full page or component

Use fullPage: true for an entire scrollable page, or a locator screenshot when the relevant evidence is one component. A full-page image can be very tall, so a focused element capture may be easier to review when the whole page is not needed.

Rank #2
HP 14" HD Chromebook Laptop for Students, Intel Quad-Core N4120(> N4020), 4GB RAM, 64GB eMMC, WiFi, Webcam, HDMI, USB-A&C, 14 Hours Battery Life, Zoom, Chrome OS, CUE Accessories
  • Intel Celeron N4120: 4 Cores & Threads, 1.1GHz Base Clock, Up to 2.6GHz Boost Clock, 4MB Cache, Intel UHD Graphics 600. The perfect combination of performance, power consumption, and value helps your device handle multitasking smoothly and reliably with four processing cores to divide up the work.

Compare against a visual baseline

For visual regression testing, use Playwright Test’s toHaveScreenshot() assertion rather than merely saving an image. On its first execution, Playwright generates a baseline; review the result and commit the accepted snapshot. Update it deliberately when an intended UI change alters the appearance. See Playwright visual comparisons for baseline behavior and configuration.

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

Investigate a failing test

A screenshot records an image, but a trace can provide the timeline, screenshots, DOM snapshots, and network context needed to understand how the test reached a failure. Traces can be linked from the HTML report and inspected in Trace Viewer or with npx playwright show-trace. For test-runner debugging, configure tracing in the Playwright Test settings; the lower-level browserContext.tracing API does not record test assertions. See the Trace Viewer guide and best practices.

Make screenshot output reproducible in CI

Rendered pixels can differ across operating systems, browser versions, browser settings, hardware, power sources, and headless mode. Generate a visual baseline and compare it in the same environment where practical. A container can help keep the environment consistent; when using a Playwright container image, match its version to the Playwright package and follow the compatibility guidance for that release.

Rank #3
Sale
AKCHART 15.6'' AI Laptop with Office 365 12GB RAM 256GB SSD Win 11 Laptops
  • Stunning 15.6" FHD IPS Display: Experience crisp 1920x1080 resolution on this 15.6 inch laptop with an IPS panel that delivers wide viewing angles and vivid colors. The narrow-bezel design maximizes screen real estate for comfortable viewing on this Win 11 laptop, whether you're studying or working.
  • Celeron J4105 Processor & 256GB SSD: Powered by a reliable Celeron J4105 processor paired with 12GB DDR4 memory and a fast 256GB M.2 SSD. This laptop computer supports SSD expansion up to 2TB and TF card expansion up to 1TB, so your storage grows with your needs. Delivers smooth multitasking for daily productivity.
  • AI-Powered Win 11 Laptop: Built-in AI features enhance your productivity with smart assistance for writing, summarizing, and task management. Pre-installed with Win 11 and includes Office 365 subscription. This student laptop is backed by 1-year warranty and 24/7 customer support.
  • All-Day 7000mAh Battery & 180° Hinge: The high-capacity 7000mAh battery keeps this laptop powered through long classes or meetings. The 180-degree lay-flat hinge lets you share your screen effortlessly during presentations. This durable laptop computer adapts to your dynamic workflow.
  • Versatile Connectivity Hub: Equipped with USB 3.2, Type-C, Mini HDMI, and 3.5mm audio jack to connect all your peripherals. Stay online anywhere with high-speed 5G WiFi and Bluetooth 4.2. This college laptop keeps you connected at home, in the library, or on the go.

Playwright recommends one worker in CI as a stability and reproducibility default. Teams with capable self-hosted runners can choose parallel workers, while sharding can distribute tests across jobs. The trade-off is throughput versus consistency and available CI resources. See the CI guide and visual comparison guidance.

Troubleshoot missing or unreliable screenshots

No artifact appears after the run

Check that the upload step ran and that its path matches where the test writes images. If tests write to artifacts/ but the workflow uploads only playwright-report/, the images are not included. Use an upload condition such as if: ${{ !cancelled() }} so artifacts can still be uploaded after a test failure.

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

The test cannot launch a browser in the runner

Install the browser binaries and required Linux packages with npx playwright install --with-deps, or use a compatible Playwright container. If using a container, check that its version matches the installed Playwright package and follow that release’s compatibility guidance.

Rank #4
HP Essential Laptop 2026, Intel CPU, 128GB Storage, Office 365, Windows 11
  • Efficient Performance for Everyday Computing: Powered by Intel N150 processor with up to 3.6 GHz Intel Turbo Boost Technology, 6 MB L3 cache, 4 cores, and 4 threads, this HP laptop delivers responsive performance for web browsing, streaming, document editing, and multitasking. Paired with 4GB LPDDR5 RAM and 128GB UFS storage, it handles daily tasks smoothly. Includes 1-year Microsoft 365 Personal subscription for Word, Excel, PowerPoint, and cloud storage to maximize your productivity.
  • 14-Inch HD Micro-Edge Display:Enjoy clear visuals on the 14-inch HD (1366 x 768) anti-glare screen with 250-nit brightness and 62.5% sRGB coverage. The micro-edge bezel delivers a 79% screen-to-body ratio in a compact design. An HP True Vision 720p HD camera with noise reduction and dual-array microphones supports clear video calls, remote work, and online learning.
  • Modern Connectivity and Wireless Technology: Stay connected with Wi-Fi 6 (2x2) for faster wireless speeds and Bluetooth 5.4 for seamless pairing with accessories. Versatile port selection includes 1 USB Type-C 10Gbps with DisplayPort 1.2 for external displays, 2 USB Type-A 5Gbps ports for peripherals, 1 HDMI 1.4b port, 1 headphone/microphone combo jack, and 1 multi-format SD media card reader. Connect monitors, transfer files quickly, and expand your workspace with ease.
  • All-Day Battery Life and Portable Design: Enjoy up to 11 hours of video playback, 7.5 hours of mixed usage, or 7.5 hours of wireless streaming on a single charge, perfect for students and professionals on the go. Weighing just 3.24 lb and measuring 12.76" x 8.86" x 0.71", this lightweight laptop fits easily in backpacks and bags. The stylish willow green top cover with matte finish and natural silver keyboard deck with vertical brushing pattern offer a modern, professional look.
  • AI-Enhanced Productivity: Access Microsoft Copilot instantly with the dedicated Copilot key for faster assistance. AI Noise Reduction filters background sounds and improves voice clarity during calls. Dual speakers provide clear audio, while the full-size natural silver keyboard and HP Imagepad support comfortable typing and navigation.

The screenshot directory is empty

Confirm that the test reached the screenshot call and that the path points to the directory you upload. In the example, mkdir('artifacts', { recursive: true }) ensures the directory exists before saving. Inspect the test result and report for navigation or assertion failures that occurred before capture.

Visual comparisons fail only in CI

First align the environment used to create and compare the baseline: operating system, browser version, settings, and headless mode can affect rendering. Keep the Playwright package and browser image compatible, and review whether parallel execution or the runner’s available resources are contributing to instability.

A screenshot is not enough to explain the failure

Enable traces on the first retry with trace: 'on-first-retry' in the Playwright Test configuration. This captures context for retrying failures without tracing every test, which Playwright documents as performance-heavy. Upload the trace-containing report or artifact, then inspect it with Trace Viewer or npx playwright show-trace.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
HP 14'' Laptop, 2027 Edition, Intel N150 CPU, 4GB DDR5 RAM, 128GB SSD, 1TB Cloud Storage, Long Battery Life, Windows 11 with Microsoft 365, Copilot AI
  • 【Powerful Performance】Equipped with an Intel N150 CPU, featuring up to 4.4 GHz, 4 cores, ensuring efficient and powerful multitasking capabilities.
  • 【Versatile Connectivity】Stay connected with multiple ports including USB 3.0 Type-C, USB 3.0 Type-A, and a headphone/mic combo jack, with Wi-Fi and Bluetooth for seamless wireless networking.
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 of a URL without running a browser in your GitHub Actions job, ScreenshotNeo provides a screenshot API and MCP server. One GET request returns an image or PDF; its API also supports capture options such as full-page screenshots, device presets, and CSS selectors.

Here is a cURL example that saves a WebP screenshot:

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 available parameters. ScreenshotNeo removes cookie banners, popups, and chat widgets before capture; bot checks, blank pages, and failed loads are not billed. Its MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000. Sign up for ScreenshotNeo’s free plan.

Frequently Asked Questions

Can I keep screenshots from a failed GitHub Actions run?

Yes. Configure the artifact upload step to run unless the workflow is cancelled, and upload the directory where the test wrote its screenshots.

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

Should I use a screenshot or a Playwright trace to debug a CI failure?

Use a screenshot to inspect a particular visual state; use a trace when you need the test timeline and additional browser context.

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. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

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.