October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk7 min

How to Take Recurring Website Screenshots with Playwright and Node.js

Build a Playwright capture function in Node.js, schedule it with a timer or external runner, and choose the right approach for screenshot archives or visual regression checks.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Playwright to capture the page, then choose how to run that capture repeatedly: a timer in a continuously running Node.js process for approximate intervals, or an external scheduler for independent, durable runs. The capture function below handles one screenshot; scheduling is a separate decision.

Capture a website screenshot with Playwright

Install Playwright in a Node.js project, save this as capture.js, and run it with node capture.js. The script creates the output directory, captures the full scrollable page, and closes the browser even if navigation or screenshot capture fails.

const { chromium } = require('playwright');
const fs = require('node:fs/promises');

async function capture() {
  await fs.mkdir('screenshots', { recursive: true });
  const browser = await chromium.launch();

  try {
    const page = await browser.newPage();
    await page.goto('https://example.com');
    const filename = `screenshots/capture-${Date.now()}.png`;
    await page.screenshot({ path: filename, fullPage: true });
    console.log(`Saved ${filename}`);
  } finally {
    await browser.close();
  }
}

capture().catch((error) => {
  console.error('Screenshot capture failed:', error);
  process.exitCode = 1;
});

Replace the example URL with the site you are authorized to capture. The timestamp helps prevent successive runs from overwriting one another; it is a naming choice, not a Playwright requirement. The Playwright Page API documents navigation and page screenshots.

Choose how the captures repeat

Playwright takes the screenshot; it does not by itself create a recurring schedule. Choose an in-process timer for a simple worker that stays running, or an external scheduler when executions should be independent of the lifetime of your Node.js process.

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.
#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.
Approach Use it when Important trade-off
Node.js timer A continuously running process should capture again after an approximate interval. The timer stops when its process stops, and callback timing depends on event-loop work.
External scheduler or CI runner You need scheduled executions that can run independently of an application process. Configure persistence, failure reporting, retries, and output storage in the scheduler you select; behavior varies by service.

Use a timer in a long-running Node.js process

This pattern waits for each capture to finish before scheduling the next one, so a slow run does not create overlapping captures. A per-run catch logs a failure without ending later scheduled attempts.

const intervalMs = 60 * 60 * 1000; // approximately every hour

async function runScheduledCapture() {
  try {
    await capture();
  } catch (error) {
    console.error('Scheduled screenshot failed:', error);
  }
}

// Start with a capture now, then repeat after each completed run.
void (async function schedule() {
  while (true) {
    await runScheduledCapture();
    await new Promise((resolve) => setTimeout(resolve, intervalMs));
  }
})();

The example waits one interval after a run completes, so the start-to-start period is the capture duration plus the configured delay. If you instead use setInterval, Node.js schedules repeated callback execution, but does not guarantee execution at the exact requested millisecond; event-loop work affects timing. See the Node.js Timers API. Keep a timer handle if you need to cancel a timer-based schedule; in this loop, add an explicit stop condition or cancellation mechanism if the worker needs graceful shutdown.

Use an external scheduler for independent runs

Keep the capture function in a script that exits after one run, then configure a task runner, operating-system scheduler, or CI scheduler to invoke it at the cadence you need. This avoids relying on one process to remain alive, but the scheduler’s persistence, retry behavior, and calendar guarantees depend on the specific service. Store images somewhere that persists beyond a temporary runner if you need an archive, and configure failure notifications where the scheduler supports them.

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.

Choose what to capture and how to save it

The Page API can save an image to a file or return image data for further processing. For one page element, use a locator screenshot instead of capturing the whole page.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Viewport screenshot: await page.screenshot({ path: 'screenshots/page.png' });
  • Full scrollable page: await page.screenshot({ path: 'screenshots/full-page.png', fullPage: true });
  • One element: await page.locator('main').screenshot({ path: 'screenshots/main.png' });
  • Image buffer: const image = await page.screenshot(); Omit path when you want to upload or transform the returned buffer rather than write the file directly.

For repeated captures, decide whether filenames should identify the run time, a fixed latest image, or both. A fixed filename is useful for a “current state” target but replaces the previous file; timestamped names preserve separate runs and require a retention policy if the archive should not grow without limit.

Wait for the page state you actually need

page.goto() navigates to the URL, but a page may still render client-side content, load images lazily, or update after navigation. When the screenshot must include a particular region or application state, wait for a meaningful locator or condition before capturing rather than assuming every page is ready at the same moment.

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.
await page.goto('https://example.com');
await page.locator('main').waitFor({ state: 'visible' });
await page.screenshot({ path: 'screenshots/ready.png', fullPage: true });

This example waits for main to become visible; choose a selector and readiness condition appropriate to the target. There is no universal wait that guarantees every site’s dynamic content has finished. A fixed delay may be needed for a known delayed update, but a meaningful page condition is usually more precise.

Make recurring captures reliable and comparable

  • Always close resources: keep browser shutdown in a finally block so failures do not leave the browser open.
  • Prevent overlap: await each run before beginning the next, or ensure the external scheduler cannot launch concurrent jobs if that matters to your archive.
  • Log useful context: record the target, run time, output location, and errors so a missing or unexpected image can be diagnosed.
  • Keep the environment stable for comparisons: browser version, host OS, settings, hardware, power source, and headless mode can change rendering. Playwright calls out these sources of visual variation in its visual comparison documentation.
  • Plan storage: choose durable output storage for scheduled runners and define how long timestamped captures should be retained.
  • Check permission and frequency: confirm that repeated requests are appropriate for the site and comply with its terms; a suitable cadence is target-specific.

Archive screenshots or test for visual changes?

If the goal is an image archive, call page.screenshot() on each scheduled run and manage filenames and retention. If the goal is to detect a change from an approved baseline, Playwright Test’s toHaveScreenshot() is the relevant assertion; it requires the Playwright test runner and baseline images. A scheduled capture is not itself a visual regression assertion.

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

Playwright Test retries repeat failed tests during a test run; they are not a mechanism for scheduling new runs at a cadence. Retries are off by default unless configured, as described in the Playwright retries documentation.

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
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common failures

The script exits before a screenshot appears

Look at the logged error and confirm the target is reachable from the machine running Node.js, the URL is correct, and the Playwright browser can launch in that environment. The capture code sets a nonzero process exit code on failure so one-off runs and schedulers can recognize an unsuccessful execution.

The screenshot is blank or missing dynamic content

Wait for a target-specific visible locator or application state before capturing. Check that the selector matches the page and that the needed content is not hidden or delayed. A navigation completing does not establish that every asynchronous update has appeared.

Runs overwrite earlier images

Use a unique filename such as the timestamped path in the example, or intentionally keep a fixed “latest” filename and separately archive older runs. Ensure the output directory exists and is writable.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.

The scheduled job does not run again

A timer is local to its Node.js process. If that process exits, its schedule ends; if the event loop is busy, callbacks may not occur at the requested exact time. For independent scheduled executions, use an external scheduler and verify its run history and process/output configuration.

Images differ even when the page seems unchanged

Compare captures in the same browser and operating-system environment, with consistent settings and headless mode. Rendering can also vary with hardware and power conditions, so pixel-level differences do not always indicate a website change.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server for developers. One GET request returns an image or PDF, without requiring you to launch and maintain a Playwright browser for each capture. See the ScreenshotNeo site and API documentation.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

For recurring captures, invoke this request from your chosen scheduler and use the scheduler and storage setup appropriate to your needs. ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before the shot; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. Its MCP server lets AI agents use screenshot tools, and the Free plan includes 1,000 screenshots per month with no card required; paid plans start at $5 for 3,000 shots.

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

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

Frequently Asked Questions

Does Playwright need its test runner to save a screenshot?

No. A standalone Node.js script can use Playwright’s Page API to navigate and save a screenshot.

Does a scheduled screenshot automatically tell me when a page changes?

No. Capturing an image archives the page state; visual change detection requires a comparison, such as Playwright Test’s screenshot assertion against a baseline.

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.

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

Leave a Reply

Your email address will not be published. Required fields are marked *

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
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

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.