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

To schedule recurring screenshots with Puppeteer, write a script that captures the page once, then use a separate scheduler to run it on a cadence. Puppeteer handles browser automation and screenshots; it does not schedule recurring runs. One documented managed setup is a Cloud Run Job triggered by Cloud Scheduler.

Build a Puppeteer script that captures one screenshot

This example uses ES modules and the puppeteer package. It navigates to a URL supplied through an environment variable, waits for a navigation condition, saves a full-page PNG, and closes the browser even if navigation or capture fails.

import puppeteer from 'puppeteer';

const targetUrl = process.env.TARGET_URL;
if (!targetUrl) throw new Error('Set TARGET_URL before running this script');

const browser = await puppeteer.launch();
try {
  const page = await browser.newPage();
  await page.goto(targetUrl, { waitUntil: 'networkidle2', timeout: 60_000 });
  await page.screenshot({
    path: `/tmp/capture-${new Date().toISOString()}.png`,
    fullPage: true,
    type: 'png'
  });
} finally {
  await browser.close();
}

Install puppeteer in the project and run the script with TARGET_URL=https://example.com node capture.js (use the actual URL and filename). The puppeteer package downloads a compatible Chrome at install time. puppeteer-core is the library-only alternative; with it, you must provide a compatible browser yourself. See the Puppeteer installation guide.

This is a starting point, not a universal readiness recipe. networkidle2 can wait indefinitely or time out on sites with ongoing requests, and a quiet network does not always mean the page’s important content is ready. Pick a condition suited to the page: for example, wait for a meaningful selector after navigation when the content is rendered asynchronously. The Puppeteer screenshot guide demonstrates navigation followed by page.screenshot().

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

Choose screenshot options for the result you need

Page.screenshot() supports output type and path, full-page capture, a clip rectangle, and other presentation controls. A relative path is resolved from the process working directory. For example, change fullPage to false for the current viewport, or supply a clip rectangle when only a specific area is needed. Review the current ScreenshotOptions API for supported fields and combinations.

Make the screenshot available after the run

The example writes to /tmp to keep the capture step simple. A temporary path inside a job container is not a durable archive: copy the image to storage that persists beyond the run before the job exits. Decide how you will retrieve, compare, and eventually remove captures; retention and storage choices depend on your deployment and are not provided by Puppeteer’s screenshot API.

For an authenticated target, provide credentials through the hosting platform’s secret mechanism or execution environment rather than committing them to source control. Keep access scoped to what the capture requires. The exact secret configuration depends on where the job runs.

Schedule the script with Cloud Run Jobs and Cloud Scheduler

Google documents a managed pattern in which a Cloud Run Job runs a finite task and Cloud Scheduler triggers it. Configure a cron-formatted frequency, timezone, and authorized service account; the account needs permission to invoke the job. The Google guide covers console, gcloud, and Terraform workflows: schedule Cloud Run jobs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Package the script and browser runtime. Build a container image with your script, Node.js dependencies, and compatible Chrome system dependencies. Puppeteer’s troubleshooting documentation discusses using a custom Dockerfile and required packages for Cloud Run: Puppeteer troubleshooting.
  2. Create a Cloud Run Job. Point the job at the image and configure its environment variables, secrets, task timeout, and retry behavior. Jobs execute tasks and exit; Google documents one-off, scheduled, and workflow execution in its Cloud Run Jobs guide.
  3. Add the Scheduler trigger. Set the cron expression and timezone to the desired cadence, and select a service account authorized to invoke the job.
  4. Verify a manual execution first. Confirm that the browser launches, the page reaches the chosen readiness condition, a screenshot is produced, and the durable-storage step succeeds before relying on the recurring trigger.
  5. Inspect logs and tune recovery. Use execution logs to diagnose failures. Set retries and alerts to match the value and frequency of your captures; the platform documentation does not prescribe screenshot-specific alert thresholds.

At the time of the Google Cloud documentation reviewed on October 3, 2026, Cloud Run Jobs task duration defaults to a 10-minute maximum and can be configured up to 168 hours for ordinary tasks. These are service limits, not a recommendation to use long-running screenshot tasks; check Google’s current limits before deployment.

Choose a scheduler and runtime that fit your setup

Cloud Run Jobs plus Cloud Scheduler is a documented managed option, not the only possible architecture. If you already have an always-on server, a system scheduler may be simpler; if you do not, a container job avoids maintaining a continuously running machine. Whichever environment you choose, check these operational details before putting captures on a schedule:

  • Browser responsibility: determine whether the runtime provides Chrome and its system libraries, or whether you must package them.
  • Time and cadence: confirm the scheduler’s cron syntax and timezone behavior, including daylight-saving transitions if relevant.
  • Access: use an identity with only the permissions needed to invoke the job and access the target or output store.
  • Failure handling: decide task timeout, retry policy, logging, alerting, and whether overlapping runs are acceptable.
  • Durability and cost: account for image storage and retention as well as compute at your chosen frequency. The available documentation does not establish a universal storage design or price for a particular screenshot workload.

Cloudflare also documents a hosted Puppeteer-compatible browser connection through Browser Run. Its integration is a patched Puppeteer client connecting to Browser Run, and Cloudflare warns that custom user agents do not bypass bot protection. A hosted browser changes where browser execution happens; it does not schedule the caller’s work, so you still need a recurring trigger. See Cloudflare Browser Run Puppeteer documentation.

Troubleshoot scheduled captures

  • Chrome executable or shared-library error: the job image may lack the browser or required system packages. Use the puppeteer install flow or package a compatible browser and dependencies; consult the troubleshooting guide.
  • Browser download missing after installation: a package manager may have blocked install scripts. Follow Puppeteer’s installation guidance for the manual browser installation command rather than assuming the download occurred.
  • Navigation timeout: ongoing requests can make networkidle2 a poor fit. Choose a more appropriate readiness condition, such as waiting for a page-specific selector, and set a timeout that matches the task’s expected duration.
  • Screenshot absent after a successful job: a local file may have been written inside the container but not copied to persistent storage. Check the upload step and destination permissions before investigating the screenshot call.
  • Scheduler invocation denied: verify that the configured service account is authorized to invoke the Cloud Run Job and that the trigger targets the intended job.
  • Intermittent missing or partial content: navigation completion is not proof that every lazy-loaded image or dynamic component is ready. Wait for the content that matters to the capture, and use full-page capture only when that is the intended result.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo can return a website screenshot or PDF from one GET request, without packaging and scheduling your own Puppeteer browser. Its API removes cookie and consent banners, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. An MCP server exposes screenshot tools for Claude, Cursor, and other MCP clients.

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

Example cURL request (see the ScreenshotNeo 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

ScreenshotNeo’s Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. To run captures on a recurring cadence, call the API from your existing scheduler or automation. Sign up for 1,000 free screenshots a month, with no card required.

Frequently Asked Questions

Can Puppeteer run screenshots automatically on a schedule by itself?

No. Puppeteer captures the page; a separate scheduler must start the script repeatedly.

Does Cloudflare Browser Run replace the scheduler?

No. It provides a hosted browser connection; the caller still needs a recurring trigger.

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.