How to Capture Full-Page Screenshots with SlimerJS
Capture an entire webpage with SlimerJS by setting the viewport, waiting for readiness, and using page.render() without onlyViewport.

Use SlimerJS’s webpage module, open the URL, set viewportSize, wait for loading (and any application-specific readiness), then call page.render(). Full-page rendering is the default: leave onlyViewport unset or set it to false.
var webpage = require('webpage');
var slimer = require('slimerjs');
var page = webpage.create();
var url = 'https://example.com/';
page.viewportSize = { width: 1280, height: 800 };
page.open(url, function (status) {
if (status === 'success') {
// onlyViewport defaults to false, so this captures full content height.
page.render('full-page.png', { format: 'png' });
}
slimer.exit(status === 'success' ? 0 : 1);
});
How SlimerJS full-page rendering works
page.render(filename, options) writes an image or PDF file. Supported documented formats include PNG, JPG/JPEG, PDF, BMP and ICO. With no viewport-only option, SlimerJS uses the rendered page content size. onlyViewport:true limits output to the current browser viewport.

| Setting | Result |
|---|---|
onlyViewport:false (default) |
Captures the full rendered content area. |
onlyViewport:true |
Captures only the visible viewport. |
clipRect |
Crops to the specified rectangle. |
format:'png' |
Writes a PNG; choose another documented format when required. |
Step-by-step setup
1. Create the webpage object
var webpage = require('webpage');
var page = webpage.create();
The page object owns the viewport, navigation and rendering operations.
2. Set the viewport before navigation
page.viewportSize = { width: 1280, height: 800 };
The viewport controls responsive layout. A viewport change can trigger asynchronous reflow, so set it before open(). If a page changes layout in response to the size, allow that reflow to settle before rendering.
3. Wait for navigation to succeed
page.open(url, function (status) {
if (status !== 'success') {
slimer.exit(1);
return;
}
page.render('full-page.png', { format: 'png' });
slimer.exit(0);
});
The successful page.open() callback indicates document loading completed. It does not guarantee that a single-page application has finished fetching or painting all application content.
4. Wait for application content when necessary
For JavaScript-rendered pages, wait for the site’s own readiness signal. A short asynchronous delay is a practical fallback, but no fixed delay works for every site.
var webpage = require('webpage');
var slimer = require('slimerjs');
var page = webpage.create();
var url = 'https://example.com/app';
page.viewportSize = { width: 1280, height: 800 };
page.open(url, function (status) {
if (status !== 'success') {
slimer.exit(1);
return;
}
// Replace this delay with a page-specific readiness check when possible.
setTimeout(function () {
page.render('app-full-page.png', { format: 'png' });
slimer.exit(0);
}, 1500);
});
Complete command-line example
slimerjs capture.js
Save the first example as capture.js. The process exits with status 0 after a successful capture and status 1 if navigation fails, which makes it suitable for scripts and CI jobs.
Useful rendering options
Viewport-only output
page.render('viewport.png', {
format: 'png',
onlyViewport: true
});
Use this when you intentionally need the visible browser area.
Crop a deliberate rectangle
page.render('header.png', {
format: 'png',
clipRect: { top: 0, left: 0, width: 1280, height: 240 }
});
clipRect is a crop, not a replacement for full-page capture. Omit it for an unrestricted page-length result.
Render in memory
var base64 = page.renderBase64('png');
var bytes = page.renderBytes('png');
Use renderBase64() or renderBytes() when another part of your program should receive the image without writing it directly to disk.
Other output formats
page.render('page.jpg', { format: 'jpg' });
page.render('page.pdf', { format: 'pdf' });
Choose the extension and explicit format together so downstream tools know what to expect.
Full working script with a readiness check
var webpage = require('webpage');
var slimer = require('slimerjs');
var page = webpage.create();
var url = 'https://example.com/dashboard';
var output = 'dashboard.png';
page.viewportSize = { width: 1440, height: 900 };
page.open(url, function (status) {
if (status !== 'success') {
console.log('Open failed: ' + status);
slimer.exit(1);
return;
}
var deadline = Date.now() + 10000;
function waitForReady() {
var ready = page.evaluate(function () {
return document.readyState === 'complete' &&
document.querySelector('[data-page-ready="true"]') !== null;
});
if (ready || Date.now() >= deadline) {
page.render(output, { format: 'png' });
slimer.exit(ready ? 0 : 1);
return;
}
setTimeout(waitForReady, 200);
}
waitForReady();
});
Change the selector to a signal your application controls. Failing when the deadline expires prevents a silently incomplete screenshot.
Common problems and fixes
| Symptom | Cause | Fix |
|---|---|---|
| Only the top portion appears | onlyViewport:true or a restrictive clipRect |
Remove both options or set onlyViewport:false. |
| Responsive layout is wrong | Viewport was set after navigation or reflow had not finished | Set viewportSize before open(); wait briefly after a size change when needed. |
| Late content is missing | Rendering started after document load but before application rendering | Wait for a page-specific selector, state flag or other readiness signal. |
| Navigation fails | The URL could not be opened successfully | Check the URL, network access and the status value; exit nonzero and retry at the caller when appropriate. |
| Output has the wrong type | Format and filename disagree or format was implicit | Set an explicit format and verify the destination path. |
| Plugin content is absent | Gecko limitations for plugin content such as Flash | Replace the plugin with an HTML-rendered equivalent or accept that it cannot be captured by this workflow. |
| Blank or partially painted page | Capture happened during navigation or asynchronous layout | Render only after successful loading and application readiness; use a bounded timeout. |
Reliability and performance considerations
- Use a fixed viewport for repeatable responsive output.
- Wait on deterministic application signals instead of increasing a delay blindly.
- Keep a timeout so a broken page cannot hold a job forever.
- Write unique output paths when capturing multiple URLs concurrently.
- Check the process exit code and preserve SlimerJS logs for failed jobs.
- Very long pages require more memory and render time than viewport shots; crop only when a crop is the intended result.
SlimerJS compatibility and project status
SlimerJS is legacy tooling. Its official project states that development ceased in 2018 and identifies SlimerJS 1.0.0 as compatible with Firefox 59. Treat browser compatibility as a deployment constraint and pin the environment used for captures. Do not assume support for newer Firefox releases without separate verification.

Or skip the browser setup
ScreenshotNeo provides a website screenshot API and MCP server. One GET request returns a PNG, JPEG, WebP or PDF. Its capture pipeline accepts consent banners and removes more than 60 known consent platforms, newsletter popups and chat widgets before the shot; each step can be turned off.
Only clean shots are billed. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads and cache hits cost nothing, and the response identifies the result with X-Page-Verdict and X-Billed headers. An MCP server provides take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients.
See the ScreenshotNeo API documentation for all options.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
ScreenshotNeo includes full-page capture with lazy images loaded, CSS-element capture, device presets and custom viewports, retina scale, PDF controls, custom CSS and JavaScript, clicks, waits, request blocking, headers, cookies, user agents, timezone, geolocation, transparent backgrounds, resizing, caching, signed links, async webhooks, bulk capture and a usage API. It has a free tier of 1,000 screenshots per month with no card; paid plans start at $5 for 3,000.
Create a free ScreenshotNeo account and start with 1,000 screenshots per month at no charge.
FAQ
Does SlimerJS capture the entire page by default?
Yes. page.render() uses the page content size unless onlyViewport:true or a crop is supplied.
What is the default SlimerJS viewport?
The documented default is 400 × 300 pixels. Set your own dimensions for predictable responsive layouts.
Should I use a delay after page.open()?
Only when the page needs additional client-side rendering. Prefer a page-specific readiness check; a delay is a fallback.
Can I return the screenshot without creating a file?
Yes. Use renderBase64() or renderBytes().
Why might a plugin not appear?
SlimerJS documents Gecko limitations for plugin content such as Flash.


