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

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

If PhantomJS is not creating a screenshot, the fix is usually to treat page.render() as the final step of a successful page load—not as a command that makes a page load. Open the URL, check that the callback status is success, wait for any asynchronous content, render to a writable filename with a supported extension, and call phantom.exit() only after rendering. The complete minimal pattern is below, followed by diagnostics for blank images, missing files, HTTPS failures, clipping mistakes and processes that exit too early.

The minimal reliable PhantomJS script

Start by reducing the job to the official quick-start flow. page.render() captures the page state currently held in the web page object. It infers the image format from the filename extension, so use an explicit path ending in .png, .jpeg, .jpg, .bmp, .ppm or .pdf. GIF output depends on the Qt build used by your PhantomJS binary.

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

page.open('http://example.com', function (status) {
  console.log('Status: ' + status);

  if (status === 'success') {
    page.render('example.png');
  }

  phantom.exit();
});

Run it from a directory where the process can write files:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
phantomjs screenshot.js
ls -l example.png

If the log says anything other than success, PhantomJS did not finish a usable document. Fix that load problem before investigating the image encoder. If the status is successful but the image is blank or unexpectedly small, continue with the timing, viewport and clipping checks below.

#1 Best Overall

Understand what page.render() does

It does not wait for your application

page.open() reports when the initial navigation has completed. A site can still be inserting data with JavaScript, loading images lazily or waiting for an API response. Rendering immediately can therefore produce a white shell or an incomplete page even though the open callback reports success.

Use a deliberate delay, or poll for a condition that proves the content exists, and render inside that asynchronous callback:

var page = require('webpage').create();
page.viewportSize = { width: 1366, height: 900 };

page.open('https://example.com/app', function (status) {
  console.log('Status: ' + status);

  if (status !== 'success') {
    phantom.exit(1);
    return;
  }

  window.setTimeout(function () {
    page.render('/tmp/app.png');
    phantom.exit();
  }, 2000);
});

The delay is only an example. Increase it when the page is known to be slow, or replace it with a test for a selector that your application adds after rendering. Always keep the render and exit calls in the same completion path; exiting before the callback runs can prevent a file from being written.

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.

A diagnostic sequence that isolates the failure

1. Confirm the executable and version

which phantomjs
phantomjs --version

Make sure the binary shown by which is the one you expect. Multiple installations can cause you to edit a script while a different PhantomJS version actually runs it. The project troubleshooting guidance recommends using the latest available version for your installation and removing ambiguity between copies.

2. Keep the load-status log

Do not remove console.log('Status: ' + status) while debugging. A status other than success points to navigation, networking or document-loading failure. Rendering in that branch only hides the original problem and often leaves no output at all.

Rank #2
Dell Latitude 3190 11.6" HD 2-in-1 Touchscreen Laptop Intel N5030 1.1Ghz 4GB Ram 128GB SSD Windows 11 Professional (Renewed)
  • 1.1 GHz (boost up to 2.4GHz) Intel Celeron N5030 Quad-Core
  • 4GB DDR4 System Memory; 128GB Solid State Drive
  • 11.6" HD (1366 x 768) Multi-Touch Display
  • Combo headphone/microphone jack - Noble Wedge Lock slot - HDMI; 2 USB 3.1 Gen 1
  • Windows 11 Pro

3. Log JavaScript exceptions from the page

Errors in site JavaScript can stop the code that creates the content you expected to capture. Add PhantomJS’s page-level error handler before opening the URL:

page.onError = function (msg, trace) {
  console.error('Page error: ' + msg);
  trace.forEach(function (item) {
    console.error('  ' + item.file + ':' + item.line +
      (item.function ? ' in ' + item.function : ''));
  });
};

A stack trace identifies whether the blank result is caused by the target page rather than by page.render().

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

4. Inspect requests and responses

When scripts, CSS, images or API calls do not arrive, instrument the resource lifecycle:

page.onResourceRequested = function (request) {
  console.log('Request: ' + request.method + ' ' + request.url);
};

page.onResourceReceived = function (response) {
  if (response.stage === 'end') {
    console.log('Response: ' + response.status + ' ' + response.url);
  }
};

Look for failed status codes, requests that never receive an ending event, or URLs that are inaccessible from the machine running PhantomJS. This is especially useful when the top-level document loads but its data endpoint does not.

5. Separate HTTP from HTTPS

If an HTTP URL renders while the equivalent HTTPS URL does not, investigate the OpenSSL and SSL libraries linked to the PhantomJS installation. An old or mismatched TLS stack can prevent the document or its subresources from loading. The status log and resource callbacks will show whether the failure occurs at the main navigation or on a dependent request.

Rank #3
Dell Latitude 5420 14" FHD Business Laptop Computer, Intel Quad-Core i5-1145G7, 16GB DDR4 RAM, 256GB SSD, Camera, HDMI, Windows 11 Pro (Renewed)
  • 256 GB SSD of storage.
  • Multitasking is easy with 16GB of RAM
  • Equipped with a blazing fast Core i5 2.00 GHz processor.

6. Disable the problematic Windows proxy default

On Windows, severe latency can come from PhantomJS’s default proxy behavior. Try launching the process with:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
phantomjs --proxy-type=none screenshot.js

If this changes a timeout into a successful load, configure the proxy explicitly for your environment rather than relying on the default.

7. Verify the destination path and extension

Use an absolute path while testing, such as /tmp/shot.png on a Unix-like system or a fully qualified writable Windows path. Check directory permissions and available disk space. A filename with an unrecognized extension can select no useful encoder; use a documented extension such as .png or .jpeg. Do not assume that a successful script means the file was written to your current terminal directory—print or inspect the absolute path.

8. Check viewport and clipping values

viewportSize controls the browser viewport. clipRect restricts the rectangle copied into the output. A rectangle positioned outside the page, or one with zero width or height, can produce an empty or tiny image even when the page itself loaded correctly.

page.viewportSize = { width: 1440, height: 900 };
page.clipRect = { top: 0, left: 0, width: 1440, height: 900 };

Remove clipRect temporarily. If the un clipped render works, add the rectangle back with coordinates that match the viewport and the element you intend to capture.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
15.6 Inch Laptop Computer, N4020, 4GB DDR4 RAM, 128GB eMMC,with Windows 11
  • EFFORTLESS EVERYDAY PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 Home system, delivering reliable, low-power efficiency for daily tasks like document editing, email, online classes, and web browsing
  • 15.6-INCH FULL HD DISPLAY: Enjoy immersive visuals on the 15.6" FHD (1920x1080) anti-glare screen with micro-edge bezels. Delivers clear details and comfortable viewing for long study sessions, working on spreadsheets, and video playback
  • RESPONSIVE MULTITASKING & STORAGE: Built with 4GB LPDDR4 RAM and 128GB eMMC storage for smooth daily essential use. Expand your storage by up to 1TB via the integrated TF card slot to easily store movies, photos, and working files
  • ADVANCED CONNECTIVITY: Outfitted with 2x Full-Featured Type-C ports for data transfer, fast charging, and dual-monitor output, alongside 2x USB 3.2 Gen1 ports and a 3.5mm audio jack for complete peripheral compatibility
  • LIGHTWEIGHT & SILENT OPERATION: Slim and portable for effortless travel or commuting. Features a 1MP HD webcam for remote meetings, 38Wh battery with 45W Type-C fast charging, and a fanless silent design for peaceful work environments.

9. Check process lifetime

Call phantom.exit() after rendering, not before it. Omitting the exit call leaves the process running; calling it immediately after page.open() can terminate the process before asynchronous work, timers or file encoding finish. For multiple pages, keep a counter or queue and exit only after the final render callback has completed.

Control the capture area and output deliberately

Setting What it controls Typical failure when wrong
viewportSize Browser viewport width and height Responsive layout changes, content appears off-screen or the image is narrower than expected
clipRect Top, left, width and height of the captured rectangle Blank output, a cropped page or a very small file
Filename extension Image or document encoder selected by page.render() No usable file or an unexpected format
Render timing Which asynchronous state is captured Blank shell, missing images or data that appears only after JavaScript runs

Set the viewport before page.open() when the page’s responsive breakpoints matter. Use a clip rectangle only when you need a fixed region; otherwise remove it while diagnosing.

Recognize the common symptom patterns

Symptom Likely cause First corrective action
No file is created Non-success load, unwritable path, unsupported extension or early exit Log status, render to an absolute .png path and move phantom.exit() after rendering
File exists but is white JavaScript content has not appeared, page script failed or a clip rectangle misses the page Add page.onError, wait for content, then remove clipRect temporarily
Only the header is visible Data API or lazy resources are still loading Trace resource requests and wait for the application’s completion condition
HTTP works; HTTPS fails SSL/OpenSSL compatibility Inspect the libraries used by the PhantomJS binary and resource-level failures
Windows runs extremely slowly Default proxy behavior Retry with --proxy-type=none
Image dimensions are wrong Viewport or clip rectangle mismatch Print the intended dimensions, set viewportSize, and remove or correct clipRect
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Deployment and maintenance considerations

PhantomJS 1.5 and later are headless and do not require X11 or Xvfb. PhantomJS 1.4 and earlier did require an X server, so an old binary can fail in a minimal server or container even when the script is correct. Confirm the version before adding display-server packages.

PhantomJS development is suspended until further notice. It is a scriptable headless browser built on QtWebKit, so treat it as a legacy component when evaluating a persistent production workflow. If troubleshooting succeeds, record the exact binary version, operating system, TLS libraries, proxy settings, viewport, clip rectangle and wait condition so a later environment change can be reproduced.

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

When a local job remains unreliable, compare replacement approaches on the things that affect your workload: JavaScript execution and wait controls, HTTPS/TLS compatibility, output formats and viewport or clip support, request and browser diagnostics, deployment burden, and whether the renderer is maintained.

Best Value
Sale
15.6 Inch Win 11 Laptop Computer, N4020, 4GB DDR4 RAM, 128GB Storage
  • WINDOWS 11 | STABLE PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 system, this laptop delivers stable performance for everyday computing tasks. It supports web browsing, online learning, document editing, email communication, and basic office work with optimized power efficiency, providing a practical and reliable experience for essential daily use for daily use.
  • 15.6” FHD IPS DISPLAY: Features a 15.6-inch Full HD IPS display with narrow bezels, offering wider viewing angles and clearer image details compared to standard panels. The improved screen-to-body ratio enhances visual experience for study, reading, document work, and video playback, making it suitable for both productivity and entertainment use.
  • 4GB DDR4 + 128GB eMMC STORAGE: Equipped with 4GB DDR4 memory and 128GB eMMC storage for everyday basics such as browsing, documents, email, and online learning platforms. The built-in TF card slot supports storage expansion up to 1TB, giving you more flexibility for files, photos, videos, and daily documents. TF card not included.
  • CONNECTIVITY & PORTS: Includes 1× TF card slot, 2× USB 3.2 Gen1 ports, and 2× full-featured Type-C ports (USB 3.2 Gen1). The Type-C ports support data transfer, charging, and video output, enabling flexible connection with external devices such as monitors, storage, and peripherals for daily work and study use.
  • LIGHTWEIGHT DESIGN | ONLINE COMMUNICATION: Designed with a slim, portable profile, this laptop is easy to carry for school, commuting, and travel. A built-in 1MP front camera supports online classes, video meetings, remote communication, and everyday conferencing. The 3300mAh battery works with the low-power system design to support practical daily use, while thermal optimization helps maintain quieter operation during extended tasks.

Or skip the browser setup

ScreenshotNeo provides a hosted screenshot endpoint when you do not want to maintain a PhantomJS process. It accepts a URL and returns PNG, JPEG, WebP or PDF. Before capture it can accept cookie or consent banners and remove more than 60 known consent platforms, newsletter popups and chat widgets; each cleanup step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers.

One GET request is enough:

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

See the parameter reference and response behavior in the ScreenshotNeo documentation.

Python

import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
    timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)

Node.js

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const body = Buffer.from(await res.arrayBuffer());
require('fs').writeFileSync('shot.webp', body);

ScreenshotNeo also supports full-page captures with lazy images loaded, CSS-selector element captures, dark mode, 12 device presets or custom viewports, retina scale, PDF paper size and margins, custom CSS and JavaScript, click-before-capture actions, selector hiding, waits for a selector, delay or network idle, blocking ads, trackers, requests or resource types, custom headers, cookies, user agents and Authorization, timezone and geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API and an OpenAPI specification. Common parameter names used by other screenshot APIs are accepted to ease migration.

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

An MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients, so an AI agent can perform captures without your writing browser orchestration. The Free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots, and every feature is included on every plan. Create a free ScreenshotNeo account.

FAQ

Can PhantomJS output GIF files?

GIF is listed among the documented formats, but availability depends on the Qt build inside the PhantomJS binary. If GIF encoding fails, use PNG or JPEG to determine whether the problem is the encoder rather than page loading.

How should I report a failure that survives these checks?

Prepare a minimized reproducible page and include the exact command, PhantomJS version, operating system, expected result, actual result, console output, network trace and relevant viewport or clip settings. A small reproduction is far more actionable than a large application archive.

Frequently Asked Questions

Can PhantomJS output GIF files?

GIF is documented, but support depends on the Qt build bundled with your PhantomJS binary. Try PNG or JPEG to separate an encoder issue from a page-loading issue.

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.

How should I report a failure that survives these checks?

Provide a minimized reproducible page, the exact command, PhantomJS version, operating system, expected and actual behavior, console output, network trace, and viewport or clip settings.

Quick Recap

Bestseller No. 1
HP 14' HD Laptop, Windows 11, Intel Celeron Dual-Core Processor Up to 2.60GHz, 4GB RAM, 64GB SSD, Webcam, Dale Pink (Renewed)
HP 14" HD Laptop, Windows 11, Intel Celeron Dual-Core Processor Up to 2.60GHz, 4GB RAM, 64GB SSD, Webcam, Dale Pink (Renewed)
14" diagonal, 1366x768 resolution, HD BrightView LED, Glossy NON-TOUCH Display
$247.99
Bestseller No. 2
Dell Latitude 3190 11.6' HD 2-in-1 Touchscreen Laptop Intel N5030 1.1Ghz 4GB Ram 128GB SSD Windows 11 Professional (Renewed)
Dell Latitude 3190 11.6" HD 2-in-1 Touchscreen Laptop Intel N5030 1.1Ghz 4GB Ram 128GB SSD Windows 11 Professional (Renewed)
1.1 GHz (boost up to 2.4GHz) Intel Celeron N5030 Quad-Core; 4GB DDR4 System Memory; 128GB Solid State Drive
Bestseller No. 3
Dell Latitude 5420 14' FHD Business Laptop Computer, Intel Quad-Core i5-1145G7, 16GB DDR4 RAM, 256GB SSD, Camera, HDMI, Windows 11 Pro (Renewed)
Dell Latitude 5420 14" FHD Business Laptop Computer, Intel Quad-Core i5-1145G7, 16GB DDR4 RAM, 256GB SSD, Camera, HDMI, Windows 11 Pro (Renewed)
256 GB SSD of storage.; Multitasking is easy with 16GB of RAM; Equipped with a blazing fast Core i5 2.00 GHz processor.
$289.99

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.