Run a browser-automation script on the remote server, then use that server’s scheduler to run it at your chosen interval. The script handles opening the page and saving the image; the scheduler handles when it runs. With Playwright, the essential capture steps are to navigate to a URL and call page.screenshot(). For a dependable recurring archive, also choose a capture state, unique filenames, retention rules, and a way to log failures.
How the recurring screenshot workflow fits together
A screenshot API does not, by itself, schedule periodic captures. Keep the jobs distinct: browser automation performs each capture, while a host-level scheduler starts the script. The general sequence is:
- Install a browser automation package and its browser runtime on the server. Follow the official Playwright installation documentation for the language and operating system you choose.
- Write a script that opens the target URL, waits for the page state relevant to your capture, saves an image, and closes the browser.
- Run it manually as the operating-system user that will own the scheduled task, using the same working directory and environment.
- Configure the server’s scheduler to run the script at the required interval. Scheduler setup differs by host and operating system; it is separate from Playwright’s screenshot API.
- Use a distinct filename for each run, decide how long to keep files, and record enough information to diagnose missed or failed captures.
Playwright’s Page API documents the core operation as creating a page, navigating to a URL, saving a screenshot, and closing the browser. The example below turns that basic sequence into a recurring-capture script with timestamped output and basic logging.
Build a Playwright screenshot script
This Node.js example captures the viewport as a PNG by default. It accepts the target URL and output directory as environment variables, creates the directory if needed, and gives each successful run a unique timestamped name. Save it as capture.mjs.
Free tools Windows power users keep installed
One-click scans. No signup required.
#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.
import { chromium } from 'playwright';
import { mkdir, appendFile } from 'node:fs/promises';
import path from 'node:path';
const targetUrl = process.env.TARGET_URL;
const outputDir = process.env.OUTPUT_DIR ?? './screenshots';
const logFile = process.env.LOG_FILE ?? './screenshots.log';
if (!targetUrl) {
throw new Error('Set TARGET_URL to the page you want to capture.');
}
const startedAt = new Date();
const stamp = startedAt.toISOString().replaceAll(':', '-');
const outputPath = path.resolve(outputDir, `page-${stamp}.png`);
let browser;
try {
await mkdir(outputDir, { recursive: true });
browser = await chromium.launch({ headless: true });
const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });
const response = await page.goto(targetUrl, {
waitUntil: 'domcontentloaded',
timeout: 60000
});
if (!response) {
throw new Error('Navigation returned no response (the page may have redirected or failed to load).');
}
if (!response.ok()) {
throw new Error(`Navigation returned HTTP ${response.status()}`);
}
// Replace or supplement this with a selector that signals your page is ready.
await page.screenshot({ path: outputPath, fullPage: true });
const message = `${new Date().toISOString()} OK ${targetUrl} ${outputPath}n`;
console.log(message.trim());
await appendFile(logFile, message);
} catch (error) {
const message = `${new Date().toISOString()} ERROR ${targetUrl} ${error?.stack ?? error}n`;
console.error(message.trim());
await appendFile(logFile, message).catch(() => {});
process.exitCode = 1;
} finally {
await browser?.close();
}
Install Playwright and its browser runtime using the official installation instructions for your chosen language and server platform. The script expects the Playwright package and Chromium runtime to be installed and available to the same user that executes it. Set TARGET_URL before running; optionally set OUTPUT_DIR and LOG_FILE to absolute paths that user can write.
The example checks for an HTTP response and records non-success status codes as errors. Some sites have unusual navigation behavior, redirects, or client-side rendering; tune the readiness check to the target rather than assuming that one wait condition fits every page. If the site’s meaningful content appears after the initial document load, wait for a relevant selector or application state before saving.
Choose viewport, full-page, format, and scale
Viewport or entire page
By default, a screenshot covers the current viewport. Set fullPage: true to capture the full scrollable page, as the example does. Full-page captures can be much taller and produce larger files. If the goal is to monitor a specific dashboard panel or a stable visible area, viewport capture may be more practical; if the whole document matters, use full-page capture and account for its size in storage and review.
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.
Image format and scale
Playwright supports PNG, JPEG, and WebP screenshots. PNG is lossless and has no quality setting; JPEG and WebP expose quality controls. Choose based on whether image fidelity or smaller files matter more for your archive. The screenshot API also supports CSS and device scale: CSS scale yields one image pixel per CSS pixel, while device scale follows the device pixel ratio and can substantially increase image dimensions and file size. Keep the choice fixed if you plan to compare captures over time.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC 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 & 11Dynamic page elements
Timestamps, rotating banners, advertisements, and animations can make captures differ even if the underlying page has not materially changed. Playwright offers screenshot styles to hide or alter dynamic elements and locator masks for selected regions. Use those only when the varying element is irrelevant to your purpose; masking or hiding can remove evidence that matters in a monitoring record.
Schedule it on the remote server
Use the scheduler already supported by the server environment. On a Linux host, a common option is cron; other operating systems and managed environments may provide different schedulers. This illustrative cron entry runs the script every 15 minutes:
*/15 * * * * cd /opt/page-capture && TARGET_URL='https://example.com' OUTPUT_DIR='/var/lib/page-capture/screenshots' LOG_FILE='/var/log/page-capture.log' /usr/bin/node /opt/page-capture/capture.mjs
Before relying on a scheduled run, verify the actual Node executable path and that the scheduled user can access the installed browser runtime and write to both output and log directories. Cron commonly runs with a limited environment, so define needed variables in the job or a script rather than relying on interactive shell settings. Scheduler syntax and environment behavior vary; consult the documentation for the host’s scheduler.
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.
Run the script once from the same directory, as the same user, with the same environment variables you plan to use in the scheduled job. Confirm that the file exists, can be opened, and corresponds to the expected page state. This catches many deployment issues before they become silent gaps in an archive.
Make recurring captures useful and repeatable
Preserve every run and control retention
A fixed filename overwrites the previous image, which defeats an archive unless overwriting is intentional. Timestamped names preserve each run. Choose a retention period based on how often you capture and how long you need historical evidence; delete or move old files accordingly. Playwright accepts an output path but does not define an archive or retention policy for you.
Log results and define failure handling
Record at least the start or completion time, target URL, output path, and failure details. The example writes successful and failed runs to a log and exits with a nonzero status for a failed capture, which makes the outcome easier for an operator or monitoring system to detect. Decide what should happen after a failure: a later scheduled run may be enough for a noncritical archive, while important monitoring may need an alert through your existing operations system.
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
Keep comparisons fair
For visual comparisons, keep the browser version, operating system, viewport dimensions, scale, and capture settings stable. Playwright notes that rendering can vary with host OS, browser version, settings, hardware, power source, and headless mode, and recommends using the same environment as the baseline. Even with stable settings, treat cross-environment pixel differences cautiously.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshoot missing, blank, or incomplete screenshots
- No output file: Check the scheduler’s working directory, output path, write permissions, Node runtime path, browser installation, and log. Run the exact command manually as the scheduled user.
- Browser launch fails: Confirm Playwright and its browser runtime were installed for the deployed environment and are accessible to the scheduled account. A package installed for a different user or environment may not be available to the job.
- Blank or incomplete capture: Check the navigation result and logs, then determine whether client-side rendering has completed before the screenshot. Wait for a page-specific selector or state when appropriate rather than simply adding a long arbitrary delay.
- Page looks different from a normal browser: Check whether the target requires a session or is affected by access controls. If it needs authentication, configure the browser context and session deliberately; do not assume an unauthenticated page is representative.
- Images or lower content are missing: Consider whether the page loads content lazily as the visitor scrolls. Full-page capture changes the captured extent, but verify the target’s loading behavior and choose a wait or interaction strategy that brings the required content into view.
- Comparisons are noisy: Stabilize browser, OS, viewport, scale, and settings first. Decide whether timestamps, animations, advertisements, or rotating content are meaningful before applying screenshot styles or masks.
- Repeated runs collide or consume too much disk: Use unique names, estimate archive growth from the actual capture cadence and image sizes, and enforce a retention or off-host storage policy appropriate to your needs.
Or skip the browser setup
For a single request that returns an image or PDF, ScreenshotNeo offers a website screenshot API. This cURL example uses the same target as above; see the ScreenshotNeo API documentation for request options.
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 and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and the response identifies the page verdict and billing status in headers. Its MCP server gives AI agents tools for taking screenshots, getting page information, and capturing PDFs. The free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month with no card.
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.
Frequently Asked Questions
Can the server capture a page that requires a login?
Yes, if you configure an authenticated browser session or context and handle credentials securely. The basic example does not sign in or provide cookies, so a protected page may not show the expected content.
Will screenshots from different servers always match pixel for pixel?
No. Rendering can vary with the operating system, browser version, settings, hardware, power source, and headless mode. Keep the capture environment consistent for meaningful comparisons.
Can I capture only one part of a page instead of the whole viewport?
Playwright’s screenshot API supports locator-based capture; target a stable element when a full viewport or full-page image is unnecessary.
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.

