To capture a webpage screenshot in GitHub Actions, install the puppeteer package, let it download its compatible Chrome for Testing browser (or install that browser explicitly), save the image with page.screenshot(), then upload the file with actions/upload-artifact. The workflow below shows the complete path from checkout to downloadable artifact.
How to take a Puppeteer screenshot in GitHub Actions
This example uses npm and a GitHub-hosted Ubuntu runner. It assumes the repository has a package-lock.json and contains the script shown below. The action versions are an illustrative pattern; check compatibility with your GitHub environment and project support policy before pinning them.
1. Add Puppeteer and a screenshot script
Install Puppeteer as a project dependency and commit the resulting lockfile:
npm install puppeteer
Create screenshot.mjs in the repository root:
import puppeteer from 'puppeteer';
const browser = await puppeteer.launch();
try {
const page = await browser.newPage();
await page.setViewport({ width: 1440, height: 900 });
await page.goto('https://example.com', { waitUntil: 'networkidle2' });
await page.screenshot({ path: 'artifacts/page.png', fullPage: true });
} finally {
await browser.close();
}
Replace https://example.com with the page you want to capture. fullPage: true captures beyond the visible viewport. The finally block closes Chrome even if navigation or screenshot writing fails.
PC 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 & 11Outdated 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 match#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
2. Add the GitHub Actions workflow
Create .github/workflows/screenshot.yml:
name: screenshot
on: [workflow_dispatch]
jobs:
capture:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
- run: npm ci
# Keep this explicit if package install scripts are blocked.
- run: npx puppeteer browsers install
- run: mkdir -p artifacts && node screenshot.mjs
- uses: actions/upload-artifact@v4
with:
name: page-screenshot
path: artifacts/page.png
if-no-files-found: error
The explicit browser-install command is useful where dependency installation scripts are disabled; where Puppeteer’s install script runs normally, Puppeteer installs its browser during package installation. GitHub’s artifact tutorial shows upload-artifact@v4, while the action repository includes later release examples. Confirm the action version against your GitHub-hosted or Enterprise Server environment rather than assuming one version fits all deployments. See the upload-artifact action documentation.
3. Run the workflow and download the image
- Push the workflow and screenshot script to the repository’s default branch.
- Open the repository’s Actions tab, select screenshot, choose Run workflow, then run it.
- When the run finishes, open the run summary and select the
page-screenshotartifact to download it.
The workflow creates artifacts/page.png; the upload step must use that same path. An artifact preserves the output beyond the job so it can be downloaded or inspected later. GitHub’s artifact guidance is at Store and share data with workflow artifacts.
How to install Chrome for Puppeteer in CI
Use Puppeteer’s managed browser by default
The puppeteer package downloads Chrome for Testing and chrome-headless-shell versions intended to work with Puppeteer. For this route, do not add a separate system Chrome installation step: use Puppeteer’s browser installation and launch defaults. Puppeteer’s installation guide gives approximate browser download sizes of 170 MB on macOS, 282 MB on Linux, and 280 MB on Windows; actual sizes can change with browser versions. See Puppeteer installation.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
When install scripts are blocked
Some package manager or repository configurations prevent dependency lifecycle scripts from running. In that case, install the project dependencies first, then explicitly run:
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsnpx puppeteer browsers install
This is Puppeteer’s documented manual browser installation command. It is included in the example workflow so the browser setup is explicit; if your package manager permits Puppeteer’s install script, you can omit the extra step.
When you use puppeteer-core
puppeteer-core does not download Chrome. Choose it when your environment manages the browser separately, then provide Puppeteer with the installed browser’s executable path in your launch configuration. This gives you control over browser provisioning, but adds responsibility for installing and keeping the browser compatible with the Puppeteer version. For the managed-browser path in the main example, use puppeteer instead.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Choose a readiness condition that fits the page
The example waits for networkidle2 during navigation, but that is not a universal signal that a screenshot is ready. Pages with analytics, polling, streaming, or other ongoing requests may never reach an idle network state, while a page may become visually ready before all network activity stops. Puppeteer’s screenshot guide documents Page.screenshot() and path-based saving; choose waits based on the site behavior. See Puppeteer screenshots.
- For a page that settles after navigation, a navigation wait such as
networkidle2can be adequate. - For a dynamic app, wait for a meaningful selector with
page.waitForSelector('.ready')after navigation, replacing the selector with one that indicates the desired content has rendered. - For application-controlled readiness, wait for a known page event or state rather than relying on network quiet.
Save one image or a set of screenshots as an artifact
Set the upload action’s path to the exact file or directory produced by the script. Uploading artifacts/ instead of artifacts/page.png is useful when a run creates multiple images. Give each artifact a descriptive name. In a matrix build, include the operating system or other matrix dimension in the name; artifacts are immutable, so separate jobs cannot modify the same named artifact. The action documentation describes the path, missing-file behavior, and naming constraints at actions/upload-artifact.
Free tools Windows power users keep installed
One-click scans. No signup required.
Set if-no-files-found: error when producing the screenshot is required for a successful run. Without it, a missing path may only produce a warning. You can also set retention-days to control how long an artifact is kept, subject to repository, organization, or enterprise policy. GitHub’s current action repository documentation describes a default retention of 90 days and values from 1 to 90; policy can impose a shorter limit. Check the current documentation for your environment before relying on a retention period.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Troubleshoot common failures
“Could not find Chrome”
The dependency install may have skipped Puppeteer’s install script, leaving the browser uninstalled. Run npx puppeteer browsers install after installing dependencies, or adjust the package manager configuration to allow Puppeteer’s install script. Refer to Puppeteer installation.
Chrome downloaded but Puppeteer cannot find it
Puppeteer has used ~/.cache/puppeteer as its default cache since v19. If the browser install and runtime use different home directories or cache paths, the launch process may not see the download. Check both paths and, if needed, set PUPPETEER_CACHE_DIR consistently for installation and runtime. See Puppeteer configuration.
Chrome exists but fails to launch on Linux
The runner may lack a shared library or font required by Chrome. Puppeteer’s troubleshooting guide lists common Debian dependencies and recommends checking unresolved libraries with ldd; the packages needed depend on the runner image. See Puppeteer troubleshooting. Do not treat --no-sandbox as a generic fix: it changes Chrome’s security posture and is not required for the managed-browser workflow described here.
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
The workflow succeeds but the artifact is missing
Compare the screenshot’s output path with the upload action’s path, and ensure the parent directory exists before writing. The example creates artifacts/ before launching the script and sets if-no-files-found: error so a missing file fails the job.
Matrix jobs report an artifact-name conflict
Use a unique artifact name per job, such as page-screenshot-${{ matrix.os }}, with a matrix value that is unique for each job. The upload-artifact action does not allow multiple jobs to modify the same named artifact.
Performance, reliability, and cost considerations
- Browser downloads: Chrome downloads add setup time and transfer volume, particularly on Linux. Pinning dependencies with a lockfile makes package resolution repeatable, but browser download sizes may change as Puppeteer updates.
- Readiness and timeouts: A wait condition that never resolves can fail or delay a job. Use a page-specific selector or application signal for sites with persistent requests, and choose a timeout suitable for the target page.
- Artifact retention: Artifacts persist only according to the action and repository policies. Set retention intentionally for your use case and verify the applicable policy.
- Required output: Use
if-no-files-found: errorwhere an absent screenshot should make the CI job fail; otherwise a warning may be enough for optional diagnostics.
Or skip the browser setup
If you need a screenshot rather than a CI-managed Chrome instance, ScreenshotNeo is a screenshot API and MCP server: one GET request can return an image or PDF. For example, from a shell:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
See the ScreenshotNeo API documentation for request options. Cookie banners are accepted and removed before capture, along with known consent platforms, newsletter popups, and chat widgets; those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies page verdict and billing status in headers. Its MCP server provides screenshot tools for AI agents, including Claude and Cursor. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Sign up for 1,000 free screenshots a month, with no card required.
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.

