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

To run Puppeteer screenshot tests on pushes and pull requests, add Puppeteer to your Node.js project, commit its lockfile, and use a GitHub Actions workflow that installs the project dependencies, runs your capture script, and uploads the resulting screenshots as artifacts. The workflow runs on GitHub’s selected runner; the developer’s physical location in India does not require a separate Puppeteer configuration.

What the workflow does

A reliable screenshot job has four parts: a known Node.js version, a Puppeteer installation that includes its compatible browser, a deterministic capture script, and saved artifacts you can inspect after the run. GitHub-hosted runners are provisioned by the workflow; GitHub documents installing additional software on those runners in its runner customization guide.

Puppeteer’s own GitHub Actions workflow is a useful first-party example of browser caching, Linux test execution, and artifact uploads. Treat it as a pattern, not as a workflow to copy wholesale: action versions and repository-specific commands may change.

Prepare the Node.js project

Install Puppeteer and commit the lockfile

Add Puppeteer as a project dependency and commit the generated lockfile. A typical npm setup is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • 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.
npm install --save-dev puppeteer

Puppeteer’s normal installation downloads a compatible Chrome for Testing browser. Its default browser cache is $HOME/.cache/puppeteer. If your package manager or CI configuration blocks install scripts, the browser download may be skipped, causing a later missing-browser launch error. See the Puppeteer installation guide.

Add a screenshot command

Create a script such as scripts/screenshot.js and add a command to package.json:

{
  "scripts": {
    "test:screenshot": "node scripts/screenshot.js"
  }
}

The following example assumes the application is already available at the URL in SCREENSHOT_URL. Set that variable to a deployed preview URL or start the app in the workflow before invoking the script.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 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.
const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({ headless: true });
  try {
    const page = await browser.newPage();
    await page.setViewport({ width: 1440, height: 1000, deviceScaleFactor: 1 });
    await page.goto(process.env.SCREENSHOT_URL || 'http://127.0.0.1:3000', {
      waitUntil: 'networkidle0',
      timeout: 60000
    });
    await page.screenshot({ path: 'artifacts/home.png', fullPage: true });
  } finally {
    await browser.close();
  }
})().catch(error => {
  console.error(error);
  process.exitCode = 1;
});

Ensure the output directory exists before the capture. For example, add const fs = require('node:fs'); fs.mkdirSync('artifacts', { recursive: true }); before saving. Pick the viewport, device scale factor, route, and page-ready condition deliberately; changes to these settings can change the image even when the page code has not changed. Puppeteer’s screenshots guide documents Page.screenshot() and related capture options.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

Configure GitHub Actions

Save a workflow such as .github/workflows/screenshots.yml. Replace the Node version with the version your project supports, and adjust the application startup and URL to match your app.

name: Screenshot tests

on:
  push:
  pull_request:

jobs:
  screenshots:
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository
        uses: actions/checkout@v4

      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '22'
          cache: npm

      - name: Install dependencies
        run: npm ci

      # If the page is served by this repository, start it here and wait
      # for its local URL to become available before taking the screenshot.
      - name: Capture screenshot
        env:
          SCREENSHOT_URL: http://127.0.0.1:3000
        run: npm run test:screenshot

      - name: Upload screenshot artifacts
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: puppeteer-screenshots
          path: artifacts/
          if-no-files-found: ignore

The example uses familiar major-version action references; check the current action releases and your Node requirements when adopting or updating a workflow. If your app is not already running, add a build/start step before capture and wait for its readiness rather than relying on an arbitrary short delay. For Linux test execution and browser caching, compare with Puppeteer’s current CI workflow.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • 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.

Optionally cache the browser download

Puppeteer’s workflow demonstrates caching browser files. Caching can avoid repeatedly downloading the browser on later runs, but the cache key should reflect the environment and Puppeteer version so an incompatible or stale browser is not reused. The workflow above omits explicit browser caching to keep the minimum setup straightforward; add it using the current upstream example if download time is material to your runs.

Make screenshot output reproducible

  • Keep the browser version stable by using the lockfile and Puppeteer’s managed compatible browser rather than silently switching browser sources.
  • Set viewport dimensions and deviceScaleFactor explicitly. Choose the same values on every run.
  • Wait for a meaningful page state. networkidle0 is convenient for mostly static pages but may not occur on applications with persistent network activity; in those cases wait for a selector that marks the content as ready.
  • Control visually relevant page state, such as test data, animations, locale, timezone, and font availability, when your application depends on them.
  • Do not assume different runner images, browser versions, or installed fonts produce pixel-identical images. Pin or control the parts that matter to your comparison.

Linux launch requirements and missing character fonts can affect startup or rendering. Consult Puppeteer’s system requirements and troubleshooting guide; install the fonts your app actually uses if they are absent from the runner.

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

Inspect captures and diagnose failures

Find the screenshot from a run

Open the completed workflow run in GitHub Actions and download the puppeteer-screenshots artifact. The upload step uses if: always() so files created before a failure can still be retained. If the capture fails before producing a file, the artifact may be empty; inspect the job log for the original error.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • 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

Common errors and fixes

Symptom Likely cause What to check
Could not find Chrome or executable The Puppeteer browser download did not run, or an incompatible executable path is configured. Check install logs and whether package scripts were disabled. Restore Puppeteer’s browser installation or explicitly provision a compatible browser as described in the installation guide.
Browser fails to launch on Linux Runner system requirements, launch configuration, or missing libraries are involved. Use Puppeteer’s Linux requirements and troubleshooting guidance; inspect the complete launch error before adding flags or system packages.
Navigation times out The target server is unavailable from the job, the app was not started, or the chosen readiness condition never occurs. Confirm the URL is reachable from the runner, start the app before capture, and use a suitable wait condition or selector.
Screenshot is blank or incomplete The page had not reached the desired state, content is lazy-loaded, or the URL resolved to an error or empty page. Verify the target URL and page state, wait for the content selector, and inspect the captured artifact and browser logs.
Text or layout differs unexpectedly Fonts, viewport, scale factor, data, locale, timezone, browser, or runner environment changed. Make relevant inputs explicit and ensure necessary fonts are available on Linux.
No artifact appears The path differs from the workflow configuration, or no screenshot was written. Ensure the script creates and writes to artifacts/, and that the upload path matches it.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What being in India changes—and what it does not

The cited Puppeteer and GitHub materials do not establish a special setup requirement based on a developer’s physical location in India. The browser runs on the runner selected by the workflow, not on the developer’s local machine. Choose locale and timezone values based on the application behavior you intend to test; there is no universally correct India-specific value for every screenshot test.

Or skip the browser setup

If you need a screenshot without managing a browser in CI, ScreenshotNeo is a website screenshot API and MCP server. One request can return an image or PDF. Cookie banners, newsletter popups, and chat widgets are removed before the capture; bot checks, blank pages, and failed loads are not billed. Its MCP server lets AI agents take screenshots, and 1,000 screenshots a month are free with no card; paid plans start at $5 for 3,000.

For a CI request, store your access key as a GitHub Actions secret and use it in the command rather than committing it to source control. The ScreenshotNeo documentation covers its API.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Sign up for ScreenshotNeo: get 1,000 screenshots a month free, with no card required.

Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 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.

Frequently Asked Questions

Can I run Puppeteer screenshot tests on every pull request?

Yes. The example workflow runs on both pushes and pull requests; tailor the trigger if you want to limit which branches or paths start a run.

Do I need to install Chrome separately when using Puppeteer?

Usually not: Puppeteer normally downloads a compatible Chrome for Testing browser during installation. A package-manager configuration that skips install scripts can prevent that download.

Does a developer in India need a different GitHub Actions runner?

The cited official setup materials do not identify an India-specific runner requirement. The workflow uses the runner selected in its configuration.

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

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.