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.

To take a website screenshot with JavaScript on your own computer, run a Node.js script with Puppeteer or Playwright. Launch a real browser, set the viewport, open the URL, wait for the content your image needs, capture the viewport, full page, or an element, then close the browser in a cleanup block.

This approach renders client-side JavaScript, CSS, fonts and images instead of downloading only the initial HTML. It is suitable for one-off captures, visual regression tests, documentation, previews and automated reports.

What you need before you start

  • Node.js and npm (or another Node package manager).
  • A project directory in which to install a browser-automation library.
  • The URL you are allowed to visit and capture.
  • A writable output path such as screenshot.png.

Puppeteer automates Chrome and Firefox through Chrome DevTools Protocol and WebDriver BiDi, while Playwright exposes Chromium, Firefox and WebKit choices. Neither is universally better; choose the browser engines and API style your project requires. See the Puppeteer overview and Playwright Page API.

Option 1: take a screenshot with Puppeteer

Install Puppeteer

  1. Create and enter a directory: mkdir local-shot && cd local-shot.
  2. Initialize the project: npm init -y.
  3. Install Puppeteer: npm install puppeteer.
  4. Save the script below as shot.mjs. The package normally downloads a compatible browser during installation; follow the installer output if your environment requires a separately managed browser.

Minimal, runnable script

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();
try {
  const page = await browser.newPage();
  await page.goto('https://example.com');
  await page.screenshot({ path: 'screenshot.png' });
} finally {
  await browser.close();
}

Run it with node shot.mjs. Puppeteer’s official Page class example demonstrates the same launch, navigation, screenshot and close sequence. The Screenshots guide identifies Page.screenshot() as the screenshot method.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

Control the viewport and wait for navigation

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();
try {
  const page = await browser.newPage();
  await page.setViewport({ width: 1440, height: 900, deviceScaleFactor: 1 });
  await page.goto('https://example.com', { waitUntil: 'networkidle2' });
  await page.screenshot({ path: 'viewport.webp', type: 'webp', quality: 85 });
} finally {
  await browser.close();
}

Set the viewport before navigation when exact dimensions matter. networkidle2 is a useful starting condition, not a guarantee that every application has finished rendering; pages with analytics, polling or lazy content may never become truly idle. Add a page-specific wait when the visual state has a known signal.

Wait for a selector or application state

await page.goto('https://example.com/dashboard', { waitUntil: 'domcontentloaded' });
await page.waitForSelector('[data-ready="true"]', { timeout: 30000 });
await page.screenshot({ path: 'dashboard.png', fullPage: true });

For a delayed animation or image, a bounded delay can help, but waiting for a selector, visible text or a completed application state is more reliable than an arbitrary sleep.

Capture a full page or one element

// Entire scrollable document
await page.screenshot({ path: 'full-page.png', fullPage: true });

// A particular component
const card = await page.$('.pricing-card');
if (!card) throw new Error('pricing card was not found');
await card.screenshot({ path: 'pricing-card.png' });

A full-page capture includes the scrollable page. An element screenshot attempts to scroll a hidden element into view before capturing it, as documented by Puppeteer. Full-page and element capture are different targets; choose the one that matches the deliverable.

Option 2: take a screenshot with Playwright

Install and choose a browser

  1. In a project directory run npm init -y.
  2. Install the library: npm install playwright.
  3. Install the browser binaries required by your environment, for example npx playwright install chromium.

Chromium script for a viewport, full page and element

import { chromium } from 'playwright';

const browser = await chromium.launch();
try {
  const context = await browser.newContext({
    viewport: { width: 1440, height: 900 },
    deviceScaleFactor: 1
  });
  const page = await context.newPage();
  await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
  await page.locator('body').waitFor({ state: 'visible' });
  await page.screenshot({ path: 'playwright.png' });
  await page.screenshot({ path: 'playwright-full.png', fullPage: true });
  await page.locator('header').screenshot({ path: 'header.png' });
} finally {
  await browser.close();
}

Playwright’s Page API shows the browser-context pattern. Its screenshot documentation covers PNG, JPEG and WebP output, CSS-pixel versus device-pixel sizing, full-page capture and element targeting. The documented fullPage: true option cannot be combined with an element target.

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

Use Firefox or WebKit when compatibility matters

import { webkit } from 'playwright';

const browser = await webkit.launch();
try {
  const page = await browser.newPage({ viewport: { width: 1280, height: 800 } });
  await page.goto('https://example.com', { waitUntil: 'networkidle' });
  await page.screenshot({ path: 'webkit.png' });
} finally {
  await browser.close();
}

Switch the import and launcher to firefox or webkit when you need screenshots from those engines. Browser rendering can differ, so keep the engine fixed for visual comparisons.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors

Make captures deterministic

Choose dimensions deliberately

Viewport width affects responsive breakpoints, while deviceScaleFactor changes the number of device pixels in the output. Set both before navigation. A mobile-sized viewport is not equivalent to merely shrinking a desktop image because many sites change layout and load different assets.

Handle lazy images and scrolling

Full-page capture may trigger scrolling, but applications vary. If images load only after an intersection event, scroll through the page or wait for the image’s complete state before capturing. For an element, target the component after it is visible rather than assuming navigation loaded it.

Freeze moving content

Carousels, blinking cursors, videos and live counters can make repeated images differ. Where permitted, inject CSS to disable transitions and animations, pause media, or capture after a stable state. Keep any injected changes specific to the capture so you do not hide real defects in a test.

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

Use the right output format

  • PNG preserves lossless detail and transparency.
  • JPEG is smaller for photographic pages but has no transparency.
  • WebP can reduce size while supporting modern quality and transparency options.

Confirm option names against the version installed. The Playwright documentation lists these formats and distinguishes CSS-pixel and device-pixel sizing.

Security, access and browser behavior

  • Only capture pages you are authorized to access. Credentials, cookies and page content can be written to disk or exposed in logs.
  • Do not place API keys, passwords or session cookies in source control.
  • Private pages may require a persistent context or an explicit login flow. Keep authentication state in a protected location.
  • Browser screenshots contain the rendered page, not the operating-system window, browser tabs, address bar or other chrome.
  • Sites may show consent dialogs, bot checks or different content to automated browsers. Treat those states as capture outcomes and handle them explicitly rather than silently accepting a misleading image.

Common failures and fixes

The script cannot find the package

Cause: the command ran outside the project, or installation failed. Fix: run it in the directory containing package.json, reinstall the package, and check that your Node.js version is supported by the installed release.

Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

Browser executable is missing

Cause: browser binaries were not downloaded or your deployment image omits them. Fix: run the library’s browser-install command, use a compatible system browser path, or build the required binaries into the image.

Navigation times out

Cause: DNS, TLS, authentication, a slow server or a page that keeps connections open. Fix: verify the URL from the same machine, set a realistic timeout, use domcontentloaded when network idle is inappropriate, and then wait for the specific element you need.

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

The screenshot is blank or incomplete

Cause: capture happened before client-side rendering, a consent layer blocked content, or lazy resources were not triggered. Fix: wait for a readiness selector, resolve the consent flow, scroll or wait for images, and save diagnostic HTML or a second screenshot of the failure state.

Full-page output is unexpectedly tall or clipped

Cause: fixed-position elements, nested scroll containers or application-managed scrolling. Fix: identify the actual scroll container, capture that element, or use a page-specific scrolling routine before the final shot.

An element selector returns nothing

Cause: the selector is wrong, the element is inside an iframe or it appears after an interaction. Fix: inspect the DOM, wait for the selector, switch to the correct frame, or perform the required click before capture.

Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

Images differ between runs

Cause: animations, timestamps, randomized content, fonts or changing network data. Fix: stabilize the data and fonts, disable motion for the test, use a fixed viewport and browser engine, and compare with an agreed tolerance rather than pixel equality when appropriate.

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

Performance and reliability choices

  • Reuse a browser process for a batch of URLs, but create an isolated context or page per job.
  • Close pages, contexts and the browser in finally blocks so failures do not leak processes.
  • Set explicit navigation and selector timeouts; an unbounded wait can stall a worker indefinitely.
  • Record the URL, viewport, browser engine, wait condition, output format and timestamp alongside each file.
  • Retry transient navigation failures with a limit. Do not blindly retry authentication failures or persistent bot challenges.
  • Use concurrency carefully: each page consumes memory and can overload the target site or your machine.

For visual regression, pin browser and library versions, keep fonts available, and run captures in a consistent environment. For one-off documentation, a simpler script and a page-specific readiness check are usually enough.

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

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. It is the first alternative to try when you want a hosted capture: cookie and consent banners, newsletter popups and chat widgets are removed before the shot; bot checks, blank pages, timeouts and failed loads are not billed; and an MCP server lets AI agents take screenshots.

One GET request returns PNG, JPEG, WebP or a PDF. The response includes X-Page-Verdict and X-Billed headers, so you can see whether the page produced a clean result and whether it was billed. The service supports full-page and element capture, device presets and custom viewports, retina scale, dark mode, custom CSS and JavaScript, clicks, selector or network-idle waits, request blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, selectable-TTL caching, signed image links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API and an OpenAPI specification. Existing parameter names used by other screenshot APIs also work.

cURL:

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

Python:

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)

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}`);

See the ScreenshotNeo documentation for request options and response handling. The Free plan includes 1,000 screenshots 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.

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

Frequently asked questions

Can JavaScript screenshot a page without a browser?

Not for a faithful rendering of a client-side site. Browser automation supplies the rendering engine; an HTTP request alone returns source rather than the final visual page.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.

Should I use Puppeteer or Playwright?

Use the library that matches your supported browser engines, project conventions and required capture APIs. The available documentation does not establish a universal winner.

Does a screenshot include the browser address bar?

No. Page screenshot APIs capture the rendered web page, not operating-system or browser chrome.

Frequently Asked Questions

Can I capture a single element that is below the fold?

Yes. Wait for the element, then use Puppeteer’s element handle screenshot or Playwright’s locator screenshot; both can bring the target into view before capture.

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

What wait condition should I use for every website?

There is no universal condition. Start with navigation readiness, then wait for the selector or application state that proves the content in your image is ready.

Which format is best for automated visual tests?

PNG is the safest default for lossless comparisons. Use JPEG or WebP when smaller files matter and your comparison process accounts for encoding differences.

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.