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

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

To capture a website screenshot with Puppeteer on an Ubuntu VPS, install a supported Node.js version and Puppeteer, make sure Chrome for Testing and its Linux dependencies are available, then launch a page, wait for the content you need, and call page.screenshot(). Puppeteer runs headless by default. The same documented setup applies in India; the VPS’s location may affect what a location-sensitive website renders, so test from the server where the script will run.

Check the VPS and choose a Puppeteer package

At the time checked in 2026, the Puppeteer project’s system requirements list Node.js 22.12 or later and Chrome for Testing support on Debian/Ubuntu Linux x64 and arm64. Requirements can change, so check that page when deploying or upgrading. Confirm your VPS architecture as well as its Ubuntu release before installing.

For the usual self-managed capture script, use puppeteer. Its installation downloads a compatible Chrome for Testing browser by default. Use puppeteer-core instead when you intend to manage a preinstalled or remote browser yourself; it does not download Chrome, so you must configure the browser connection or executable as appropriate. See the project’s installation guide.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Package Best fit Browser setup
puppeteer A script that should manage its compatible browser installation for you Downloads Chrome for Testing by default during installation
puppeteer-core A separately managed, preinstalled, or remote browser Does not download Chrome; configure the browser you will use

India does not imply a different Puppeteer installation path in the reviewed official documentation. A site can nevertheless vary its output by network location, language, or other settings. The example below does not set a timezone or geolocation; configure those deliberately if they are part of the result you need.

Install Node.js, Puppeteer, and its browser

Use a Node.js installation that meets Puppeteer’s current system requirement. From your project directory, install the package:

npm init -y
npm install puppeteer

Allow the package’s install script to run so Puppeteer can download its compatible Chrome for Testing browser. If the environment blocks install scripts, the browser may be missing even though the package itself is present. After installing the package, Puppeteer documents this manual browser-install command:

npx puppeteer browsers install

On a minimal Ubuntu VPS, Chrome may also need operating-system libraries that are not installed by the Node package manager. If Chrome exits on launch or reports a missing shared library, consult Puppeteer’s current troubleshooting guide for the required Debian/Ubuntu dependencies and diagnose the missing library rather than adding arbitrary packages.

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

Capture a full-page screenshot

This ES module example navigates to a target URL, waits for a network-idle condition, captures the full page as a PNG, and closes Chrome even if navigation or capture fails:

import puppeteer from 'puppeteer';

const url = 'https://example.com';
const outputPath = 'screenshot.png';

const browser = await puppeteer.launch();
try {
  const page = await browser.newPage();
  await page.goto(url, { waitUntil: 'networkidle2' });
  await page.screenshot({ path: outputPath, fullPage: true });
  console.log(`Saved screenshot to ${outputPath}`);
} finally {
  await browser.close();
}

Save this as screenshot.mjs and run node screenshot.mjs. The official screenshot guide demonstrates Page.screenshot() and uses networkidle2 in its example. That wait condition is not a guarantee that every application has finished rendering: pages with polling, delayed content, or lazy-loaded elements may need an application-specific wait instead.

Choose what is ready before capturing

  • Use waitUntil: 'networkidle2' as a starting point when the page settles after its requests complete.
  • If the site keeps network connections active or renders important content later, wait for a meaningful selector or a page-specific condition before calling screenshot().
  • For content below the initial viewport, use fullPage: true when you want the full document. A full-page capture is not a substitute for verifying that lazy content has actually loaded.

Readiness is site-specific; no single navigation condition proves every website is visually complete. Prefer a selector that represents the content you need, and make the wait bounded if you add a custom wait so a missing element does not leave the job hanging indefinitely.

Capture one element instead of the whole page

When the desired output is a single component, locate it and use ElementHandle.screenshot() rather than capturing the whole page. Puppeteer documents this API in its ElementHandle screenshot reference.

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.
const card = await page.waitForSelector('.product-card');
if (!card) {
  throw new Error('Product card was not found');
}
await card.screenshot({ path: 'product-card.png' });

Replace .product-card with a selector that identifies the element on the target site. The explicit missing-element check keeps a failed selector from being mistaken for a successful capture.

Keep the browser sandbox enabled where possible

Do not make --no-sandbox the default fix for a server launch problem. Puppeteer’s troubleshooting documentation strongly discourages running without Chrome’s sandbox because it removes a security boundary that helps protect the host from untrusted web content.

Instead, investigate whether the browser architecture is supported, whether required system libraries are present, and whether the host’s sandbox configuration is blocking Chrome. Puppeteer documents a possible AppArmor interaction on Ubuntu 23.10 and later in which user-namespace restrictions can lead to a “No usable sandbox!” error with Puppeteer-downloaded Chrome for Testing. Treat that as a version- and environment-specific diagnostic, not as a claim that all Ubuntu VPS instances have the issue.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. One GET request returns a PNG, JPEG, WebP, or PDF; its API documentation is at screenshotneo.com/docs. For example, save this as shot.mjs and run it with Node.js:

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.
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://example.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot request failed: ${res.status}`);
await import('node:fs/promises').then(({ writeFile }) => writeFile('shot.webp', res));

With the API, cookie and consent banners, newsletter popups, and chat widgets are removed before capture; each cleanup step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots, and every feature is available on every plan.

Create a free ScreenshotNeo account to get 1,000 screenshots a month with no card.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common Puppeteer failures

Symptom Likely cause What to check or do
Could not find Chrome The install script did not run, or the browser was not installed for the environment executing the script. Allow Puppeteer’s install script or run npx puppeteer browsers install. Check that the browser cache is available to the same operating-system user that runs the service.
Chrome exits immediately or reports a missing shared library A required Linux dependency is absent, or the browser architecture is unsupported. Verify x64 or arm64 support for your setup and use Puppeteer’s troubleshooting dependency list to identify and install the missing Ubuntu package.
No usable sandbox! The host’s sandbox configuration may be preventing Chrome from using its sandbox; Ubuntu 23.10+ AppArmor behavior is one documented possibility for the described Chrome for Testing setup. Diagnose host configuration and preserve the sandbox if possible. Avoid treating --no-sandbox as a routine workaround; it weakens isolation from untrusted page content.
Screenshot is blank or missing expected content Navigation finished before the application rendered the needed content, or the chosen readiness condition does not match the site. Wait for a meaningful selector or page-specific condition. Confirm the element exists before capture and that lazy content has loaded.
The result differs from a local screenshot The target site may vary content by the VPS’s network location or by locale-related settings. Compare results from the actual India VPS, and explicitly configure and record any timezone or geolocation assumptions that matter to your use case.

Operational notes for a VPS deployment

Reliability and cleanup

Always close the browser in a finally block, as in the example, so a failed navigation does not leave Chrome processes running. If this is part of a long-running worker, handle each capture’s errors at the job boundary and ensure one failed page does not prevent browser cleanup.

Output and permissions

The example writes a relative filename in the process’s current working directory. For a service, choose an output directory that exists and is writable by the service account, and use an explicit path if the working directory is not stable. Ensure the account that runs the script can also access Puppeteer’s downloaded browser cache.

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

Cost and infrastructure

Puppeteer and Chrome for Testing are software components; the VPS itself is a separate hosting cost. This guide does not recommend a particular provider or claim a specific India-region price, availability, uptime, or capacity. Check your provider’s current region and instance details against your workload.

FAQ

Does a Puppeteer script need a desktop environment on Ubuntu Server?

No. Puppeteer runs headless by default, so the screenshot workflow does not require a visible desktop session.

Can I use Puppeteer with a browser installed outside the project?

Yes. That is the use case for puppeteer-core, which does not download Chrome; you are responsible for configuring the browser it controls.

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.

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