Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon 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×
FREEDOM251

Freedom251 › Blog › Cron

How to Set Up Website Screenshot Monitoring with Cron and Puppeteer

By Freedom251 Team · · 6 min read

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

Use Puppeteer to open a page and save a screenshot; use cron to run that script on a schedule. For repeatable comparisons, keep the browser, viewport, login state, wait condition, and output policy consistent. A screenshot is only the evidence-gathering step: you still need to decide what counts as a meaningful change and how to be alerted.

What the setup does—and what it does not

Puppeteer controls a browser and captures the page. Cron starts your script at specified times. Together they create a recurring visual record, but they do not by themselves compare images, decide whether a difference matters, or notify you. Those monitoring rules are separate decisions.

As an Amazon Associate I earn from qualifying purchases.

Install Node.js, Puppeteer, and its browser

In a project directory, install Puppeteer:

npm init -y
npm install puppeteer

The puppeteer package downloads a compatible Chrome during installation. The puppeteer-core package is an alternative without that browser download; use it only if you will provide and configure a browser yourself. Package managers can block installation scripts, leaving the browser unavailable. If that happens, install it explicitly with:

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

Headless Chrome may also need platform-specific libraries or sandbox configuration on Linux or cloud hosts. Check Puppeteer’s troubleshooting documentation for deployment problems; requirements depend on the host environment.

#1 Best Overall
Sale
Norton 360 Deluxe 2027 Antivirus, 5 Devices, Auto-Renews [Download] | Includes Scam Protection, Advanced VPN, Dark Web Monitoring, & PC Cloud Backup
  • ONGOING PROTECTION Download instantly & install protection for 5 PCs, Macs, iOS or Android devices in minutes!
  • TOP-PERFORMING VPN Faster speeds, more server locations, and greater connection control to protect your privacy across all your devices, including Smart TVs.
  • ADVANCED SCAM PROTECTION Help spot hidden scams online. With the built-in Genie AI assistant, you’ll never wonder if a message or email is suspicious again.
  • REAL-TIME PROTECTION Advanced security protects against existing and emerging malware threats, including ransomware and viruses, and it won’t slow down your device performance.
  • DARK WEB MONITORING Identity thieves can buy or sell your information on websites and forums. We search the dark web and notify you should your information be found.

Write a repeatable capture script

Create /opt/site-monitor/capture.mjs (or another absolute path) with this example. It expects TARGET_URL and SCREENSHOT_PATH in the environment. Pin the package and browser versions for a maintained monitoring job, and adjust the viewport and readiness condition to the target site.

import puppeteer from 'puppeteer';

const url = process.env.TARGET_URL;
const outputPath = process.env.SCREENSHOT_PATH;
if (!url || !outputPath) throw new Error('Set TARGET_URL and SCREENSHOT_PATH');

const browser = await puppeteer.launch();
try {
  const page = await browser.newPage();
  await page.setViewport({ width: 1440, height: 900 });
  const response = await page.goto(url, {
    waitUntil: 'networkidle2',
    timeout: 60_000,
  });
  if (!response || !response.ok()) {
    throw new Error(`Navigation did not return a successful response: ${response?.status()}`);
  }
  await page.screenshot({ path: outputPath, fullPage: true });
} finally {
  await browser.close();
}

Puppeteer’s screenshot guide demonstrates page.goto(), page.screenshot(), and closing the browser. The networkidle2 setting is only an example wait condition, not a guarantee that every site’s visual content is ready. For delayed content, wait for a known selector or an application-specific readiness signal. A relative screenshot path is resolved from the process working directory, so an absolute path is safer under cron.

Choose what the image contains

The example uses fullPage: true to capture the full page. Puppeteer also supports a viewport capture by omitting that option, a clipped region with clip, image type, and a destination path. Decide whether every run should replace one file such as latest.png or create a timestamped history; comparison and retention depend on that choice.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Norton 360 Deluxe 2027 Antivirus, 3 Devices, Auto-Renews [Download]
  • ONGOING PROTECTION Download instantly & install protection for 3 PCs, Macs, iOS or Android devices in minutes!
  • TOP-PERFORMING VPN Faster speeds, more server locations, and greater connection control to protect your privacy across all your devices, including Smart TVs.
  • ADVANCED SCAM PROTECTION Help spot hidden scams online. With the built-in Genie AI assistant, you’ll never wonder if a message or email is suspicious again.
  • REAL-TIME PROTECTION Advanced security protects against existing and emerging malware threats, including ransomware and viruses, and it won’t slow down your device performance.
  • DARK WEB MONITORING Identity thieves can buy or sell your information on websites and forums. We search the dark web and notify you should your information be found.

Keep comparison conditions stable

Use the same viewport and relevant page state on every run. If the page depends on authentication, cookies, locale, or other browser settings, keep those consistent too. Without a deliberate readiness condition, dynamic content such as ads, clocks, or rotating promotions may change between captures even when the underlying site is behaving as expected.

Schedule the job with cron

Edit the crontab for the account that should own and run the job:

crontab -e

A user crontab uses five time-and-date fields followed by the command. This example runs daily at 07:00 and appends both standard output and errors to a log:

0 7 * * * TARGET_URL='https://example.com' SCREENSHOT_PATH='/var/lib/site-monitor/latest.png' /usr/bin/node /opt/site-monitor/capture.mjs >> /var/log/site-monitor.log 2>&1

Replace the Node executable, script, output directory, and log path with locations that exist on your host and are writable by the crontab owner. The command runs as that crontab’s owner. Cron supplies a default shell and environment that differ from an interactive terminal, so use explicit paths and define required environment variables in the command or a protected configuration method. Cron’s time zone is host/configuration-dependent; confirm it for the machine running the schedule.

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

If output is not redirected, POSIX cron behavior provides for mail delivery, but the actual delivery mechanism is implementation-defined and may not be configured. A log file or a deliberately configured notification path is more diagnosable.

Test before relying on the schedule

  1. Run the exact command as the scheduled user from a clean shell, with the same environment and permissions cron will have.
  2. Confirm the image appears at the expected absolute path and is readable. Check that the output directory exists and the scheduled user can write to it.
  3. Trigger a failure deliberately, such as using an invalid target URL, and confirm the command exits unsuccessfully and leaves useful diagnostics in the log.
  4. After the scheduled time, check that the cron entry ran and that its output or configured notification is observable.

These checks catch differences between an interactive login shell and cron’s default environment before they become silent gaps in the screenshot history.

Rank #4
Sale
McAfee Total Protection 2027 Antivirus Software for 3 Devices | Auto-Renews
  • THREAT DETECTION – Stay one step ahead. Suspicious links, risky sites, viruses, and scams, caught automatically before they reach you.
  • PERSONAL INFO PROTECTION – Keep your personal info safer. Identity monitoring watches for your exposed info and tells you what to do about it.
  • SECURE CONNECTIONS – Just a few easy clicks, and we'll automatically protect your info on public Wi‑Fi, every time you connect.
  • GUIDED ACTION – Know what matters and what to do next. Clear alerts and simple guidance make it easy to take action.
  • MORE THAN ANTIVIRUS – Scam protection, identity monitoring, VPN, web protection, and antivirus work together to protect you, all in one place.

Turn screenshots into monitoring signals

Choose the monitoring policy to match the page rather than treating every pixel difference as an incident.

  • Frequency and retention: choose how often to capture and how long to keep history, balancing the desired audit trail with storage.
  • Scope: use a viewport, full-page image, or clipped element consistently so the comparison covers the part that matters.
  • Diff signal: decide whether a pixel-level comparison is useful or whether a threshold or region-aware comparison better filters irrelevant changes. There is no universal threshold established for all sites.
  • Noise: dynamic ads, clocks, rotating content, and consent banners can produce differences unrelated to a meaningful page change.
  • Failure state: record navigation status and errors as well as images. Decide whether retries are appropriate and what to do when the target or monitoring host is unreachable.
  • Alert route: explicitly configure how an actionable change or a failed capture reaches an operator. A screenshot alone does not send an alert or establish site health.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common failures

The browser executable is missing

A blocked package install script may have prevented Puppeteer’s Chrome download, or puppeteer-core may have been installed without a separately configured browser. Install the compatible browser with npx puppeteer browsers install, or configure the browser executable for the package you chose.

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

The script works manually but not from cron

Cron may use a different PATH, environment, working directory, user, or permissions. Use absolute paths for Node, the script, and output; define the required variables; and test as the crontab owner. Verify the cron time zone and inspect redirected output.

Navigation times out or captures an incomplete page

networkidle2 may not match the site’s loading behavior, and some pages keep network requests open. Conversely, a page can satisfy a network-idle condition before delayed visual content is ready. Use a site-specific selector or readiness signal, and check the navigation response and logs rather than assuming a screenshot proves success.

The screenshot cannot be written

Confirm that the destination directory exists and is writable by the scheduled user. Use an absolute SCREENSHOT_PATH; relative paths depend on the process working directory.

Chrome exits on a Linux or cloud host

Headless Chrome can depend on host libraries or sandbox configuration. Follow the Puppeteer deployment troubleshooting guidance for the specific environment instead of applying a sandbox workaround blindly.

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.

Images differ on every run

Check whether viewport, locale, authentication, cookies, browser version, or readiness timing varies. Identify dynamic regions such as ads or clocks and decide whether to exclude or tolerate them in the comparison policy.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server for developers. A single GET request can return an image or PDF; the example below saves a WebP capture. See the API documentation for parameters.

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

ScreenshotNeo accepts cookie or consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots.

Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month without a card.

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.

CronNode.jsPuppeteerwebsite monitoringwebsite screenshots

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.

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