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 add website screenshot functionality, use a browser automation library to open a URL, wait for the page state your application needs, then capture the viewport, full page, or a specific element. Playwright and Puppeteer support those capture modes and can save an image to disk or return image data for further processing.

Choose the capture method that fits your application

For most application code, start with a browser automation framework rather than calling the browser’s lower-level protocol directly. Playwright offers screenshot support across its language bindings; Puppeteer provides a JavaScript automation API. Chrome DevTools Protocol (CDP) exposes a lower-level screenshot command for integrations that need protocol-level control.

Need Approach What to account for
Capture the visible page page.screenshot() in Playwright or Puppeteer Only the current viewport is captured; content below the fold is excluded unless full-page capture is enabled.
Capture a long page Playwright fullPage: true The result is a tall image. Confirm that the consuming interface can display or process its dimensions.
Capture one component Playwright locator screenshot or Puppeteer element screenshot Useful for a component or region instead of the whole page. Puppeteer attempts to scroll a hidden element into view.
Process or return the image Return screenshot bytes or a buffer; optionally encode as base64 Base64 is a representation of the image data, not a separate capture method.
Capture a responsive layout Set the viewport before navigating Check viewport dimensions and device-scale settings for the pixel output your application expects.
Use a lower-level browser interface CDP Page.captureScreenshot Offers protocol-level control; most application code can begin with a framework API.

Build the capture flow

  1. Choose a framework and language. Match the library to your application and deployment stack. Playwright documents multiple language bindings; Puppeteer is a JavaScript library for browser automation. Google Chrome for Developers describes Puppeteer as providing a high-level API to automate Chrome and Firefox over Chrome DevTools Protocol and WebDriver BiDi (Puppeteer overview).
  2. Launch or reuse a browser and create a page. Decide whether your service should create a browser for each task or keep browser resources available according to its lifecycle. Close resources when they are no longer needed.
  3. Set the viewport before navigation. Choose the CSS viewport dimensions for the target layout before opening the URL. Some sites do not expect their screen size to change after loading, so resizing later can produce a different layout (Playwright Page API).
  4. Navigate and wait for the right readiness condition. A navigation event alone may not mean that client-rendered content is ready. Wait for an application-specific signal when the page renders asynchronously.
  5. Select the capture scope. Capture the visible viewport, use full-page mode for the scrollable page, or target a locator or element.
  6. Choose the output destination. Provide a file path to save an image, or handle the returned buffer or bytes in memory for storage, processing, or delivery.

Implement with Playwright

Install Playwright and its browser binaries using the installation instructions for your environment. The following JavaScript example sets a viewport before navigation, waits for a selector that represents application readiness, and writes a full-page screenshot to a file:

const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch();
  try {
    const page = await browser.newPage({
      viewport: { width: 1440, height: 900 },
    });
    await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
    await page.locator('main').waitFor({ state: 'visible' });
    await page.screenshot({ path: 'screenshot.png', fullPage: true });
  } finally {
    await browser.close();
  }
})();

Replace main with a selector that only becomes visible when the content you need is ready. To capture the visible viewport instead, omit fullPage: true. To capture one component, use a locator screenshot:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
await page.locator('.header').screenshot({ path: 'header.png' });

Playwright can also return image data instead of writing a file, which is useful when the next step is image processing or an upload:

const imageBytes = await page.screenshot({ fullPage: true });

Consult the Playwright screenshots guide for capture options and examples.

Implement with Puppeteer

Puppeteer’s screenshot guide demonstrates a navigation using waitUntil: 'networkidle2'. Treat that as an example, not a universal readiness rule: applications with delayed client rendering may need a more specific signal.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  try {
    const page = await browser.newPage();
    await page.setViewport({ width: 1440, height: 900 });
    await page.goto('https://example.com', { waitUntil: 'networkidle2' });
    await page.screenshot({ path: 'screenshot.png', fullPage: true });
  } finally {
    await browser.close();
  }
})();

For an element capture, select the element and call its screenshot method:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const header = await page.$('.header');
if (!header) throw new Error('Header element not found');
await header.screenshot({ path: 'header.png' });

Puppeteer also documents returning screenshot data as bytes or base64, depending on the requested output format and options. See the Puppeteer screenshots guide and Page.screenshot() API for the supported options.

Choose viewport, full-page, or element capture deliberately

Viewport capture

A normal page screenshot represents the currently visible browser area. Use it when the consumer needs a preview of a page at a particular responsive size; specify the viewport before navigation so the page loads with that layout.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Full-page capture

Full-page mode produces a tall image that includes content beyond the initial viewport. It may be less convenient for interfaces that expect a fixed-size preview, and the resulting image dimensions should fit your storage and downstream processing needs.

Element capture

Element screenshots isolate a component such as a header, card, or chart. Prefer a stable selector tied to the page’s structure, and ensure the element exists before capture. Puppeteer notes that an element screenshot attempts to scroll a hidden element into view; this behavior can affect the page’s scroll position.

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

Handle output as a file or image data

Passing a path writes an image file, as in the examples above. If you omit a path, framework APIs can return image data for in-memory work. That is useful when your code needs to upload the screenshot, transform it, or return it from an endpoint without first writing a file. Base64 encoding can be useful where a text representation is required, but it adds an encoding layer rather than changing how the page was captured.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
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 provides a screenshot API and MCP server for developers. A single GET request can return a PNG, JPEG, WebP, or PDF. Before capture, it accepts cookie or consent banners as a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each 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 includes take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients.

Example cURL request (replace YOUR_API_KEY with your access key):

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

See the ScreenshotNeo documentation for the API details. You can also call it from Python:

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

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

Or from Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://example.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. Sign up for ScreenshotNeo’s free plan.

Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Troubleshoot common capture problems

  • The screenshot is blank or missing app content. The page may not have finished rendering when the capture ran. Wait for a selector or another application-specific readiness signal instead of relying only on navigation completion.
  • The page has the wrong responsive layout. Set the viewport before navigation and verify the CSS viewport dimensions and device-scale behavior expected by the framework.
  • Content below the fold is missing. Enable full-page capture. If you need only a region, capture its locator or element instead.
  • An element screenshot fails because the selector is absent. Verify the selector against the rendered page and wait for the element to exist or become visible before capturing it.
  • Navigation never reaches the chosen idle state. A page may keep network activity open or load content after the selected navigation condition. Use a readiness signal tied to the content your application needs; networkidle2 is an example, not a guarantee.
  • The screenshot is much taller than expected. Full-page mode includes content beyond the viewport. Use a viewport or element capture if a tall page image is not suitable for the consumer.

Performance, reliability, and cost considerations

The cited framework documentation defines screenshot APIs and options, not comparative throughput, fidelity, or hosting costs. Measure behavior in your own deployment and target pages rather than assuming identical results across browser engines or environments.

  • Browser lifecycle: Reusing browser resources may suit a service that captures many pages, while a short-lived task can close its browser after capture. Manage pages and browser processes according to your service’s isolation and lifecycle needs.
  • Readiness: Waiting longer can improve completeness for delayed rendering, but a generic idle condition may not match every site. Use page-specific signals where possible and set operational time limits in your application.
  • Image scope: Full-page images can be substantially larger in dimensions than viewport screenshots. Choose the smallest capture scope that meets the downstream need.
  • Output handling: Writing files is straightforward for local jobs; buffers or bytes avoid an intermediate file when passing results to another service.
  • Consistency: Browser engine, viewport, device scale, page state, and timing can affect the rendered output. Pin the settings your workflow depends on and validate captures in the actual runtime.

When to use the lower-level DevTools Protocol

Chrome DevTools Protocol exposes Page.captureScreenshot through its Page domain (CDP Page domain). This is useful when an integration already speaks CDP and needs protocol-level access. For typical application code, Playwright or Puppeteer provides a higher-level starting point with page navigation and capture APIs.

Frequently Asked Questions

Can I capture screenshots in a language other than JavaScript?

Yes. Playwright documents multiple language bindings; select the binding that matches your application stack.

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.

Does a screenshot automatically include content below the fold?

No. A standard page screenshot captures the viewport; request full-page capture when you need the long page.

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.