October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk6 min

How to Schedule Recurring Website Screenshots with PhantomJS

Schedule recurring PhantomJS screenshots by separating the capture script from its Linux or Windows scheduler—and account for the project’s suspended status.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To schedule recurring website screenshots with PhantomJS, write a JavaScript capture script, confirm it runs manually, then schedule the PhantomJS command with cron on Linux or Task Scheduler on Windows. Keep in mind that PhantomJS is legacy software: its project says development is suspended, and its upstream repository is archived and read-only. Check that it works with your host and target pages before relying on it.

Separate the capture from the schedule

PhantomJS is a headless, JavaScript-scriptable browser. Your script opens a page and renders it; the operating system’s scheduler launches that script at the times you choose. This division makes the job easier to test: first make a manual capture work, then schedule the same command.

As an Amazon Associate I earn from qualifying purchases.

The PhantomJS project states, “Important: PhantomJS development is suspended until further notice.” Its upstream GitHub repository is archived and read-only. The project’s published command-line material identifies 2.1.1 as its latest release. Do not assume its rendering, security, or web-platform behavior matches a current browser; validate it against the actual websites and machine you intend to use. This is best treated as a way to maintain an existing setup, not as a newly maintained browser automation stack.

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

Create and run a capture script

Save this as capture.js, changing the URL and output path. It follows the PhantomJS quick-start pattern: create a webpage, open the URL, render only after a successful load, then exit the process. PhantomJS quick start

var page = require('webpage').create();

page.open('https://example.com/', function (status) {
  if (status === 'success') {
    page.render('/opt/capture/example.png');
  } else {
    console.log('Page failed to load: ' + status);
  }
  phantom.exit();
});

Use a full, absolute output path. A scheduled process may start in a different working directory from your interactive shell. This example uses one fixed filename, so each successful run overwrites the prior image. For a history of captures, change the script to create a unique filename for each run, for example by including a timestamp; ensure the destination directory exists and is writable by the account running the task.

  1. Find the PhantomJS executable path on the host where the schedule will run.
  2. Run it manually as the same operating-system account that will own the scheduled job: /usr/local/bin/phantomjs /opt/capture/capture.js. Adjust both paths to your installation.
  3. Check the exit behavior, log output, saved file, file permissions, and network access. If the target requires authentication or relies on modern browser features, test those conditions explicitly; this minimal example does not configure credentials or guarantee compatibility.

The PhantomJS command-line form is phantomjs [options] somescript.js [args...]. Command-line documentation

Choose capture dimensions and output

The capture guide documents PNG, JPEG, GIF, and PDF output, as well as viewport and clip-rectangle controls. Set the viewport dimensions in the page script when the browser window size matters. Set page.clipRect when you need a particular rectangle. A viewport-sized capture should not be assumed to include the full height of a long page. PhantomJS screen capture guide

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Free Fling File Transfer Software for Windows [PC Download]
  • Intuitive interface of a conventional FTP client
  • Easy and Reliable FTP Site Maintenance.
  • FTP Automation and Synchronization

Choose dimensions based on the screenshot’s purpose: a fixed viewport for consistent visual checks, or a clip rectangle for a known region. Test the resulting file on your target pages, particularly when content loads asynchronously. The capture example renders after the page-open callback succeeds; that alone does not establish that every delayed image, font, or client-rendered element has finished appearing.

Schedule the command on Linux with cron

For a daily run at 06:30 in the machine’s local timezone, add a crontab entry like this, replacing paths with the actual executable, script, and log locations:

30 6 * * * /usr/local/bin/phantomjs /opt/capture/capture.js >> /opt/capture/capture.log 2>&1
  1. Open the crontab for the account that should run the job with crontab -e.
  2. Add the entry, using absolute paths and the intended local schedule time.
  3. Save it, then check the crontab and log after the next due run. Confirm the output file changed or a new archive file appeared.

Cron reads crontab instructions to run commands at scheduled times; exact behavior and configuration can vary by system. Check that host’s crontab(1) and crontab(5) documentation. Linux crontab manual The machine must be running and able to reach the target when the job is due.

Schedule the command on Windows with Task Scheduler

In Task Scheduler, create a task with a recurring trigger and an action that starts the PhantomJS executable with the script path as its argument. Set the working directory and run account in the task’s properties where needed, and quote paths containing spaces.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Create a task and choose the trigger frequency, such as daily, weekly, or monthly.
  2. Set the action’s program to the full path of phantomjs.exe; pass the full script path as an argument.
  3. Set the appropriate account and working directory, then run the task manually from Task Scheduler and inspect its history and output location.

Microsoft’s schtasks command also supports recurring daily, weekly, and monthly schedule types. Requirements for creating or managing tasks can depend on the account and permissions; Microsoft documents administrator requirements for scheduling and managing all local tasks. Microsoft schtasks reference

Check time, account, and file behavior

  • Timezone: Set the schedule for the host’s intended timezone, not an assumed timezone from another machine.
  • Availability: The computer or server needs to be powered on and hosted when a run is due.
  • Permissions: The scheduled account needs permission to execute PhantomJS, access the network, read the script, and write to the output directory.
  • Output policy: Decide whether each run overwrites the prior screenshot or creates an archive, and check available disk space if retaining files.
  • Diagnostics: Redirect cron output to a log or use Task Scheduler history so missed or failed runs are easier to investigate.

If a machine must remain available specifically for this job, hosting is one possible solution; verify that the chosen environment can run the legacy PhantomJS executable before depending on it.

Troubleshoot common failures

Symptom Likely cause What to check
No screenshot appears The job used a different working directory, the destination directory is missing, or the scheduled account cannot write there. Use an absolute output path, create the directory, and check permissions as the scheduled account.
The task works manually but not on schedule The scheduler uses a different account, environment, executable path, working directory, or timezone. Run the exact command as the task account; specify absolute paths and inspect cron logs or Task Scheduler history.
The log says the page failed to load The host may lack network access, DNS resolution may fail, or the target may reject or time out the request. Check connectivity from the scheduled host and review captured status and scheduler logs. Do not treat a successful process launch as proof that the site loaded.
The image is blank or missing late content The target may depend on asynchronous resources, newer browser behavior, authentication, or other features unsupported by this suspended project. Validate the page in the installed PhantomJS version and test the relevant loading and access conditions. Do not assume the result will match a current browser.
Only part of a long page appears The script may be rendering the viewport or a limited clip rectangle rather than the whole page. Review the capture dimensions and clip settings against the guide; do not assume viewport capture means full-page capture.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If you need recurring screenshots but do not want to maintain this legacy browser workflow, ScreenshotNeo provides a website screenshot API and MCP server. A single GET request can return an image or PDF. For example, this cURL request saves a WebP capture; see the ScreenshotNeo documentation for API 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 and consent banners before capture and removes known consent platforms, newsletter popups, and chat widgets; each cleanup step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server offers take_screenshot, get_page_info, and capture_pdf tools for AI agents. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots.

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

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

Frequently Asked Questions

Does the PhantomJS script need to call phantom.exit()?

Yes. Call it after rendering or handling a failed page open so the PhantomJS process terminates instead of remaining active.

Can I use the same schedule on Linux and Windows?

The capture command is the same in principle, but the scheduler configuration is platform-specific: cron on Linux and Task Scheduler or schtasks on Windows.

Does this example guarantee a full-page screenshot?

No. The capture guide documents viewport and clip-rectangle controls; choose and validate the dimensions you need.

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.

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. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
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.