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

There are two different ways to capture user-contributed web content: automate a browser that loads the submitted page, or ask a person to share a screen or window through the browser’s Screen Capture API. Use Playwright when your service controls navigation and needs a repeatable PNG, JPEG, WebP, or PDF-style workflow. Use getDisplayMedia() when a person must choose what is currently visible on their device. The APIs have different permissions, outputs, privacy boundaries, and failure modes.

This guide shows both routes, complete runnable examples, scope controls, privacy safeguards, troubleshooting, and a hosted alternative for teams that do not want to operate browser infrastructure.

Choose the capture route first

Question Browser automation (Playwright) User-selected display capture
Who initiates selection? Your automation code opens a URL and selects a page or element. The person confirms a browser prompt and chooses a screen, window, or tab.
Primary output Image bytes or a file; the page can also be inspected and manipulated before capture. A live MediaStream, which you can render, record, or extract frames from.
Scope Viewport, full scrollable page, clipped rectangle, or locator-selected element. A display surface selected by the user; newer Element/Region Capture APIs can narrow a shared tab.
Privacy boundary Your code decides what the loaded page contains and what is saved. The user controls the selected surface, but an entire display can include notifications, private tabs, or credentials.
Repeatability High when URL, viewport, waits, browser version, and content are controlled. Lower: the selected surface and visible state depend on the person and device.
Typical use Moderation evidence, previews, archives, visual tests, and submitted URLs. Support sessions, demonstrations, collaborative review, and content that exists only on a user’s screen.

Do not describe getDisplayMedia() as a one-shot screenshot API. It returns a stream. A screenshot is a later frame-extraction step.

Route 1: capture a submitted page with Playwright

Playwright’s Page API can save a screenshot to a path or return image bytes when no path is supplied. A full-page capture includes the page’s complete scrollable height; a locator screenshot limits output to one element. The API also supports clipping, masking, output type, quality for lossy formats, and scaling.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
ANNKE 3K Lite Wired Security Camera System Outdoor, 8X 2MP Cameras, 1TB HDD
  • AI Motion Detection 2.0 – Driving AI to the next level, human&vehicle detection and flexible detection area are more accurate than before. For quicker locating in crucial moments, human&vehicle smart searching in recordings offers you great help.
  • Tried-and-True Safe Guard – This one-stop security solution can work with TVI, AHD, CVI, CVBS & IP cameras, the kit includes 1080P cams. The 8CH 3K lite DVR can hook up with 1080P@30fps or 3K/5MP@20fps cams. Therefore, you can also DIY it with other cameras in your home.
  • Reliable 24/7 Continuous Recording – With a pre-installed 1TB HDD(Support up to 10TB HDD), providing 24/7 surveillance recording for you. Upgraded H.265+ saves more storage space and uses less bandwidth, recording videos longer and smoother viewing.
  • Smart Dual-Light Effectively Guard Your Home – This newly upgraded security system offers you a crisp full color night vision, IR mode and color night vision switch flexibly. Once detect intruders, immediate pushes pop up on your phone, securing your peace of mind day&night.
  • Color Night Vision & IP67 Weatherproof – Built-in IR lights and white lights, these cameras can see up to 100ft in B&W night vision, full-color night vision up to 66ft. Rated IP67, these wired cameras can brave all weather, and stand from cold to hot.

Install and launch a browser

npm install playwright
npx playwright install chromium

The following Node.js script accepts a submitted URL, waits for the page to settle, and writes a full-page WebP. Validate and constrain URLs in a real service; unrestricted fetching can create server-side request-forgery and internal-network risks.

import { chromium } from 'playwright';

const target = process.argv[2];
if (!target) throw new Error('Usage: node capture.mjs https://example.com');
const url = new URL(target);
if (!['http:', 'https:'].includes(url.protocol)) throw new Error('Only HTTP(S) URLs are allowed');

const browser = await chromium.launch();
const page = await browser.newPage({
  viewport: { width: 1440, height: 900 },
  deviceScaleFactor: 1
});
try {
  await page.goto(url.href, { waitUntil: 'networkidle', timeout: 45_000 });
  await page.screenshot({
    path: 'submitted-page.webp',
    fullPage: true,
    type: 'webp',
    quality: 85
  });
} finally {
  await browser.close();
}

networkidle is useful for pages that finish loading their requests, but it is not a guarantee that late animations or application data are complete. Prefer a meaningful readiness signal when the submitted site provides one.

Capture only an element

const card = page.locator('[data-submission-card]').first();
await card.waitFor({ state: 'visible', timeout: 10_000 });
await card.screenshot({
  path: 'submission-card.png',
  type: 'png'
});

A locator screenshot is safer for moderation or previews because unrelated navigation, comments, and account details are outside the selected element. The selector must exist in the page you loaded; treat a missing selector as a failed capture rather than silently taking a different region.

Control the exact pixels

  • fullPage: true: captures the full scrollable document instead of only the viewport.
  • clip: captures a rectangle in page coordinates when you know the exact x, y, width, and height.
  • mask: overlays selected element bounding boxes, useful for hiding email addresses or tokens in evidence images. A mask is not permission to republish the underlying content.
  • type and quality: choose PNG for lossless text and transparency, or JPEG/WebP for smaller lossy files. Quality applies to supported lossy formats.
  • scale: choose CSS-sized output or device-scaled output when you need predictable dimensions across high-density displays.

Set a fixed viewport, timezone, locale, color scheme, and device scale when visual consistency matters. Disable or wait for animations, and explicitly wait for images or a content selector that proves the user submission is rendered.

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

Make dynamic pages deterministic

  1. Navigate only to an allow-listed scheme and host policy.
  2. Wait for a selector that represents completed content, not merely the document’s first response.
  3. Use a bounded timeout and record whether navigation, selector waiting, or screenshotting failed.
  4. Hide transient UI such as cookie banners only when your policy allows it; otherwise capture the page as presented.
  5. Close the browser context after each job or tenant boundary so cookies and local storage do not leak between users.
await page.goto(url.href, { waitUntil: 'domcontentloaded', timeout: 30_000 });
await page.locator('main [data-user-content]').waitFor({ state: 'visible', timeout: 15_000 });
await page.addStyleTag({ content: `*, *::before, *::after { animation: none !important; transition: none !important; }` });
const bytes = await page.screenshot({ fullPage: true, type: 'png' });
await fs.promises.writeFile('capture.png', bytes);

Do not assume a screenshot proves that content is authentic, complete, or legally reusable. A submitted page may contain copyrighted work, personal data, or material that changes after capture. Define moderation, consent, retention, deletion, and jurisdiction rules separately from the technical capture.

Rank #2
Sale
aosu D1 Classic 4-Cam Kit, Security Cameras Wireless Outdoor, Solar Powered
  • No Subscription Required with aosuBase: All recordings will be encrypted and stored in aosuBase without subscription or hidden cost. 32GB of local storage provides up to 4 months of video loop recording. Even if the cameras are damaged or lost, the data remains safe.aosuBase also provides instant notifications and stable live streaming.
  • New Experience From AOSU: 1. Cross-Camera Tracking* Automatically relate videos of same period events for easy reviews. 2. Watch live streams in 4 areas at the same time on one screen to implement a wireless security camera system. 3. Control the working status of multiple outdoor security cameras with one click, not just turning them on or off.
  • Solar Powered, Once Install and Works Forever: Built-in solar panel keeps the battery charged, 3 hours of sunlight daily keeps it running, even on rainy and cloud days. Install in any location just drill 3 holes, 5 minutes.
  • 360° Coverage & Auto Motion Tracking: Pan & Tilt outdoor camera wireless provides all-around security. No blind spots. Activities within the target area will be automatically tracked and recorded by the camera.
  • 2K Resolution, Day and Night Clarity: Capture every event that occurs around your home in 3MP resolution. More than just daytime, 4 LED lights increase the light source by 100% compared to 2 LED lights, allowing more to be seen for excellent color night vision.

Route 2: let a person share a live display

The Screen Capture API’s navigator.mediaDevices.getDisplayMedia() method asks the user to choose a screen, window, or tab and resolves to a MediaStream. The browser presents an active-capture indicator. Audio can be offered by some user agents, but support and behavior vary.

Request a stream after a user gesture

<button id="share">Choose a tab or screen</button>
<video id="preview" autoplay muted playsinline></video>
<script type="module">
const button = document.querySelector('#share');
const video = document.querySelector('#preview');
button.addEventListener('click', async () => {
  try {
    const stream = await navigator.mediaDevices.getDisplayMedia({
      video: { frameRate: { ideal: 30, max: 60 } },
      audio: false
    });
    video.srcObject = stream;
    stream.getVideoTracks()[0].addEventListener('ended', () => {
      video.srcObject = null;
      button.disabled = false;
    });
    button.disabled = true;
  } catch (error) {
    console.error('Display capture was not started', error);
  }
});
</script>

Call it from a clear user action such as a button click. A user can cancel the picker, deny permission, or stop sharing later. Handle all of those outcomes as normal control flow, not as server errors.

Extract a still image from the stream

async function captureFrame(video) {
  if (video.readyState < HTMLMediaElement.HAVE_CURRENT_DATA) {
    await new Promise(resolve => video.addEventListener('loadeddata', resolve, { once: true }));
  }
  const canvas = document.createElement('canvas');
  canvas.width = video.videoWidth;
  canvas.height = video.videoHeight;
  canvas.getContext('2d').drawImage(video, 0, 0);
  return await new Promise(resolve => canvas.toBlob(resolve, 'image/png'));
}

const pngBlob = await captureFrame(video);
const form = new FormData();
form.append('image', pngBlob, 'display-capture.png');
await fetch('/uploads/display-capture', { method: 'POST', body: form });

This captures the frame currently rendered in the video element. It does not retroactively recover pixels that were never delivered, and it does not remove private information visible on the chosen surface. Apply server-side size limits, malware scanning, authentication, and retention rules to the upload.

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.

Reduce accidental exposure

  • Tell the person exactly whether to choose a tab, window, or entire screen.
  • Ask them to close or hide notifications, password managers, private messages, and unrelated tabs.
  • Prefer a narrow surface over an entire display when the workflow permits it.
  • Stop tracks when the session ends: stream.getTracks().forEach(track => track.stop()).
  • Show a visible preview and provide a discard action before uploading.

Permissions Policy can govern whether display capture is allowed by a document or iframe through the display-capture directive and an iframe allow attribute. Policy allowance does not remove the user’s confirmation prompt.

Element Capture and Region Capture

For supported browsers, newer capture controls can narrow what is shared from a tab. Element Capture targets a rendered DOM tree and its descendants, which is useful when content outside that tree—such as notification overlays—must be excluded. Region Capture clips to an element’s bounding box, so overlapping content may remain visible. These APIs and their browser availability can change; verify the exact target browsers before committing to them.

Rank #3
Sale
Blink Outdoor 4 – Wireless smart security camera, two-year battery life, 1080p HD day and infrared night live view, two-way talk. Sync Module Core included – 3 camera system
  • Outdoor 4 is our most affordable wireless smart security camera yet, offering up to two-year battery life for around-the-clock peace of mind. Local storage not included with Sync Module Core.
  • See and speak from the Blink app — Experience 1080p HD live view, infrared night vision, and crisp two-way audio.
  • Two-year battery life — Set up in minutes and get up to two years of power with the included AA Energizer lithium batteries and a Blink Sync Module Core.
  • Enhanced motion detection — Be alerted to motion faster from your smartphone with dual-zone, enhanced motion detection.
  • Person detection — Get alerts when a person is detected with embedded computer vision (CV) as part of an optional Blink Subscription Plan (sold separately).

If your requirement is a reliable, repeatable image of a known URL, Playwright remains the simpler route. If the content is visible only in a person’s authenticated desktop application, display capture may be the only practical route.

Privacy, consent, and publication rights

Technical permission is not the same as permission to publish. A browser prompt confirms that a person selected a surface for capture; it does not establish that every visible page, image, name, message, or document may be stored or redistributed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Define who may submit content and what categories are prohibited.
  • Tell contributors what will be captured, why, where it will be stored, and how long it will remain.
  • Minimize collection: element or clipped captures usually expose less than a full display or full page.
  • Redact secrets before publication and restrict original files to authorized staff.
  • Provide deletion and takedown procedures appropriate to your jurisdiction and use case.
  • Log consent and capture time separately from the image so an audit does not require exposing the image itself.

These are product and jurisdiction decisions, not guarantees supplied by Playwright or the Screen Capture API.

Or skip the browser setup

ScreenshotNeo is a hosted website screenshot API and MCP server. One GET request returns a PNG, JPEG, WebP, or PDF and supports full-page capture, lazy-image loading, element selectors, custom CSS and JavaScript, clicks, waits, device presets, dark mode, retina scale, blocking rules, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, caching, signed links, asynchronous jobs, webhooks, bulk capture, usage data, and an OpenAPI specification. Its parameter names also accept the names commonly used by other screenshot APIs, which can simplify migration.

Before capture, it can accept cookie or consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing result.

One-call examples

See the full parameter reference in the ScreenshotNeo documentation.

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.
Rank #4
Sale
ANNKE 8CH H.265+ 3K Lite Wired Security Camera System,4X 2MP Cam, 1TB HDD
  • 【AI Motion Detection 2.0】Driving AI to the next level, human&vehicle detection and flexible detection area are more accurate than before. For quicker locating in crucial moments, human&vehicle smart searching in recordings offers you great help.
  • 【Tried-and-True Safe Guard】This one-stop security solution can work with TVI, AHD, CVI, CVBS & IP cameras, the kit includes 1080P cams. The 8CH 3K lite DVR can hook up with 1080P@30fps or 3K/5MP@20fps cams. Therefore, you can also DIY it with other cameras in your home.
  • 【Reliable 24/7 Continuous Recording】With a pre-installed 1TB HDD(Support up to 10TB HDD), providing 24/7 surveillance recording for you. Upgraded H.265+ saves more storage space and uses less bandwidth, recording videos longer and smoother viewing.
  • 【Smart Dual-Light Effectively Guard Your Home】This newly upgraded security system offers you a crisp full color night vision, IR mode and color night vision switch flexibly. Once detect intruders, immediate pushes pop up on your phone, securing your peace of mind day&night.
  • 【Color Night Vision & IP67 Weatherproof】Built-in IR lights and white lights, these cameras can see up to 100ft in B&W night vision, full-color night vision up to 66ft. Rated IP67, these wired cameras can brave all weather, and stand from cold to hot.
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)
r.raise_for_status()
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}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
const bytes = Buffer.from(await res.arrayBuffer());
await import('node:fs/promises').then(fs => fs.writeFile('shot.webp', bytes));

ScreenshotNeo is useful when you need repeatable URL capture without installing browsers or maintaining workers. Cookie banners, popups, and chat widgets are removed before the shot; bot checks, blank pages, and failed loads are never billed; and its MCP server lets AI agents such as Claude or Cursor call take_screenshot, get_page_info, and capture_pdf. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

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

Troubleshooting

The Playwright image is blank or incomplete

Check that navigation did not merely reach an app shell. Wait for a content selector, increase the bounded timeout, and confirm that the selector exists in the same frame or shadow-DOM context. Disable animations and wait for lazy images before taking a full-page shot.

The page never finishes at networkidle

Analytics, chat, and streaming connections can keep a page busy indefinitely. Use domcontentloaded followed by a specific readiness selector, or intercept requests that your policy allows you to block.

The locator screenshot throws “element not found”

The submitted page may use a different template, delayed rendering, an iframe, or a changed selector. Treat this as a schema/version mismatch, return a clear validation error, and keep a deliberate fallback rather than capturing an unrelated element.

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

getDisplayMedia() is rejected

The user may have cancelled, denied permission, or invoked the method outside an allowed context. Call it from a user gesture, serve the page in the browser context required by your target, and distinguish cancellation from an operational failure in your UI.

The stream stops unexpectedly

The user can press the browser’s stop control, close the shared tab, or change the selected surface. Listen for the video track’s ended event, clean up the preview, and let the user start a new capture.

Best Value
Sale
Blink Video Doorbell + Outdoor 4 – Wireless smart security cameras, head-to-toe HD view, two-year battery life. Sync Module Core included – 3 camera system + Video Doorbell
  • Video Doorbell is our second-generation smart security doorbell with up to two years of battery life, an expanded field of view, and improved security features for more peace of mind, no matter where you are.
  • Last longer with two-year battery life — Experience up to two years of smart security coverage on both devices with included AA Energizer lithium batteries and a Blink Sync Module (included with Outdoor 4).
  • See and speak from the Blink app — Experience head-to-toe HD viewing from Video Doorbell and 1080p HD live view from Outdoor 4 as well as infrared night vision and crisp two-way audio.
  • See more at your door with Blink Video Doorbell — Greet guests and watch packages get delivered, day and night, with head-to-toe HD view and infrared night vision. Use two-way talk to hear and speak through the Blink app.
  • Enhanced motion detection with Outdoor 4 — With our all-new Outdoor 4, enjoy a wider field of view and be alerted to motion faster with dual-zone, enhanced motion detection.

The upload is too large

Limit canvas dimensions and request size, resize on the client only when that does not undermine evidence, and enforce the same limits on the server. PNG preserves text but can be much larger than WebP or JPEG.

Different browsers produce different results

Display selection, audio, Element Capture, Region Capture, and rendering details vary. Pin your Playwright version and browser binaries for automation, and test every browser and operating-system combination you promise for user-driven capture. No single cross-browser performance or compatibility percentage should be assumed.

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

Operational checklist

  • Choose automation for submitted URLs and user display capture for content that exists on a person’s screen.
  • Set URL, network, timeout, file-size, and storage limits before accepting submissions.
  • Capture the smallest useful region and record the capture time and configuration.
  • Wait for application-specific readiness instead of relying only on page load events.
  • Handle cancellation, blocked pages, missing selectors, stopped streams, and partial uploads explicitly.
  • Separate technical capture permission from publication, retention, and takedown decisions.
  • Verify browser support for every Screen Capture, Element Capture, and Region Capture feature you use.

Frequently Asked Questions

Can getDisplayMedia() save a PNG directly?

No. It returns a live MediaStream. Render a video track and copy a frame to a canvas, then export the canvas as PNG, JPEG, or another supported format.

Which route captures a full web page?

Playwright’s page.screenshot({ fullPage: true }) captures the full scrollable page loaded by the automation browser. Display capture is limited to the surface the person selects.

Does a screenshot grant rights to republish submitted content?

No. Capture permission and publication rights are separate. Your product needs its own consent, moderation, retention, and takedown rules.

Can I prevent all private information from appearing in a screen share?

No guarantee is possible for an entire display. Ask the user to choose the narrowest surface, use supported element or region capture where appropriate, preview the frame, and provide redaction and discard controls.

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

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.