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

To capture a New Relic dashboard with legacy CasperJS, set an explicit viewport, open the dashboard in an authorized browser session, wait for a dashboard-specific readiness condition, then call capture() for the page or captureSelector() for one element. CasperJS uses PhantomJS’s 400 × 300 default viewport unless you change it, and a visible dashboard element does not necessarily mean its charts have finished rendering. CasperJS is no longer actively maintained, so for routine exports consider New Relic’s built-in PDF, PNG, or JSON download or its NerdGraph snapshot API.

Choose CasperJS only when browser capture is the requirement

CasperJS is useful here if you need to preserve an existing script or capture the dashboard as it appears in a browser at a particular viewport. Its documented capture methods can save a full page, a clipped rectangle, or a selected element. You control the browser viewport and the point at which the capture runs.

For ordinary dashboard exports, New Relic also documents UI downloads in PDF, PNG, or JSON, plus programmatic dashboard snapshots through NerdGraph. Those options avoid maintaining an automated browser script. The right route depends on whether you need a browser-rendered view or an export generated by New Relic itself.

The CasperJS project repository says the project is no longer actively maintained. Treat the script below as a legacy-maintenance pattern, not as confirmation that CasperJS works unchanged with every current New Relic dashboard or login flow. CasperJS project repository

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

Prepare the dashboard and browser session

  1. Confirm the exact dashboard URL. Use the dashboard page you intend to capture, not a general New Relic landing page.
  2. Arrange authorized access outside the sample script. The browser process must be able to reach the dashboard with an authorized session. The CasperJS documentation cited here does not establish a New Relic-specific login procedure. Do not place passwords, session tokens, or other credentials in source code, logs, or a screenshot.
  3. Choose the output and framing. Decide whether you need the whole rendered page, a rectangular clip, or a particular dashboard element. Set the viewport to match the intended display size before capturing.
  4. Identify a meaningful readiness signal. Choose a selector or condition that reflects the dashboard state you actually need. A selector becoming present can be an early signal; it does not guarantee that asynchronous charts and data have finished rendering.

CasperJS documents viewport(), waitForSelector(), capture(), and captureSelector() in its casper module documentation. The PhantomJS viewport default is 400 × 300, and CasperJS does not override it automatically. An unintended default can make a dashboard appear cramped, trigger responsive layouts, or cut off content.

Capture a dashboard with CasperJS

This pattern sets a deliberate viewport, navigates to a dashboard, waits for an application-specific selector, and saves a full-page image. Replace the URL, selector, dimensions, and filename for your environment. The selector is intentionally a placeholder: use an element that exists on your dashboard.

Rank #2
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option
var casper = require('casper').create();

casper.start('https://YOUR_NEW_RELIC_DASHBOARD_URL');

casper.viewport(1920, 1080, function () {
  this.waitForSelector('YOUR_DASHBOARD_READY_SELECTOR', function () {
    this.capture('dashboard.png');
  });
});

casper.run();

This is an illustrative structure using documented CasperJS APIs, not a tested script for a particular New Relic account. Verify the viewport callback behavior and selector against the CasperJS version and dashboard you maintain. In particular, a dashboard may render its charts after the surrounding DOM has appeared; add a page-specific readiness condition if the screenshot must include completed chart content. The documentation establishes selector waiting, but does not promise that selector presence means all dashboard data has loaded.

Capture the full page

Use capture('dashboard.png') when the desired artifact is the rendered page. Check the resulting image for clipping, unexpected responsive layout, or portions of the dashboard that did not finish rendering. A large viewport can show more dashboard content, but its dimensions should be chosen deliberately for the output you need.

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.
Rank #3
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers

Capture a region or one element

For a defined rectangular area, CasperJS documents a clip rectangle with capture(). When you want a specific DOM element instead of a hand-positioned rectangle, use captureSelector('dashboard.png', 'CSS_SELECTOR') and substitute a selector that identifies the target element on the page. Element capture is preferable when the desired boundary follows an element rather than fixed screen coordinates.

Wait for the right state

CasperJS provides waitForSelector() and waitFor() patterns for waiting before a later step. Prefer a condition linked to the dashboard’s actual content over an arbitrary fixed sleep. If charts populate asynchronously, inspect the page behavior and choose a condition that indicates the charts are ready, rather than assuming that the dashboard container alone is enough. A fixed delay can be too short on a slow load and waste time on a fast one.

Use New Relic’s native export when it fits

New Relic documents dashboard downloads from its UI as PDF, PNG, or JSON. This is generally the simpler path when you want a normal dashboard export and do not need a scripted browser to interact with the rendered page. See Manage your dashboard and Import, export, and add dashboards and charts.

For programmatic exports, New Relic documents the NerdGraph dashboardCreateSnapshotUrl mutation for dashboard-page snapshots in PDF or PNG. The API supports custom dimensions and variable overrides; the full-dashboard snapshot requires the dashboard page GUID, not the dashboard GUID. New Relic also documents exporting a single chart through a widget snapshot mutation. Consult its dashboard and chart import/export documentation and NerdGraph dashboard tutorial for the mutation context and parameters.

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

A material security distinction: New Relic says generated dashboard snapshot URLs are publicly accessible without authentication and expire after three months. Anyone with access to such a link may be able to view the snapshot during that period. Assess the dashboard’s data policy before creating or distributing one; do not treat the URL as private merely because it was created from an authenticated account. New Relic dashboard export documentation

Which approach fits?

Need Legacy CasperJS New Relic export
Capture browser-rendered page or selected element Yes: page, clip rectangle, or selector capture; requires browser setup and a readiness strategy. UI or NerdGraph export produces New Relic dashboard or chart snapshots rather than a CasperJS browser interaction.
Output formats Image capture as configured in the script; the cited CasperJS documentation describes capture APIs. UI downloads: PDF, PNG, or JSON. NerdGraph snapshot URL: PDF or PNG.
Dimensions and dashboard variables Control viewport for browser rendering; no New Relic variable-override behavior is established for CasperJS. NerdGraph documents custom dimensions and variable overrides for dashboard snapshots.
Maintenance Higher: CasperJS is no longer actively maintained, and browser/page behavior must be checked in the legacy setup. Uses New Relic’s documented UI or API export path instead of maintaining a CasperJS capture flow.
Sharing exposure A locally saved image is an artifact; its later exposure depends on where you store or share it. Snapshot URLs are public without authentication and expire after three months, according to New Relic.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common capture problems

  • The screenshot is only 400 × 300 or the layout looks narrow. Set the viewport explicitly with casper.viewport(width, height, callback) before capture. CasperJS retains PhantomJS’s documented 400 × 300 default unless changed.
  • The screenshot is blank or shows a sign-in page. Confirm the URL and ensure the browser process has authorized access before the capture step. The sources here do not define a CasperJS-specific New Relic authentication recipe; arrange credentials through an approved session setup rather than embedding them in the script.
  • The page appears, but charts are empty or incomplete. Waiting for a top-level dashboard selector may be insufficient. Identify a chart-specific or data-ready condition for the actual page, and confirm the capture runs only after that state is reached.
  • A selector wait never reaches the capture callback. Check that the CSS selector is valid for the rendered page and that it appears in the current dashboard state. A selector copied from another dashboard or layout may not match.
  • The browser capture flow is difficult to keep working. Since CasperJS is no longer actively maintained, consider replacing routine exports with New Relic’s UI or NerdGraph method rather than investing further in a legacy browser workflow.
  • A NerdGraph export times out. New Relic’s export tutorial notes that large dashboard time windows or many widgets can cause timeouts. Try reducing the time window or removing unused widgets, then retry. New Relic NerdGraph export tutorial

Or skip the browser setup

If you need an image from a publicly reachable page and would rather not maintain a CasperJS browser flow, ScreenshotNeo provides a one-request screenshot API. It is not a substitute for an authenticated New Relic export unless you arrange authorized access using supported request credentials; choose New Relic’s native export for workflows that depend on its dashboard permissions and variables.

The API can return an image or PDF from a URL. For example, this cURL call saves a WebP capture of a target page; replace the URL and use your API key:

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

See the ScreenshotNeo API documentation for request options. ScreenshotNeo removes cookie/consent banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, failed loads, and cache hits are not billed. Its MCP server gives AI agents screenshot tools, and the free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.

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

Sign up for 1,000 free screenshots a month, with no card required.

Maintenance recommendation

Keep CasperJS for a legacy capture only when the browser-rendered result or existing automation is specifically needed, and verify its behavior against your dashboard. For regular exports, start with New Relic’s PDF, PNG, or JSON UI downloads or its NerdGraph snapshot flow; account for the public nature and three-month expiration of snapshot URLs when deciding how to handle the resulting link.

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.