October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk6 min

How to Screenshot a Specific HTML Element in Chromium

Playwright is the straightforward way to save one Chromium element as a still image; Chrome Element Capture instead restricts a live video stream.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a saved image of one DOM element, use browser automation such as Playwright and call the screenshot method on a locator or element handle. This is different from Chrome’s Element Capture API, which restricts a live tab-capture video stream rather than saving a still image.

Take a still screenshot of one element with Playwright

Playwright’s screenshot API can target an element by selector or element reference and save it as PNG, JPEG, or WebP. For a script or automated test, a locator is usually the simplest option: it identifies the element and lets Playwright wait for it before capturing.

As an Amazon Associate I earn from qualifying purchases.

Install Playwright

For a Node.js project, install Playwright and its Chromium browser:

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.
npm init -y
npm install playwright
npx playwright install chromium

Capture an element by CSS selector

Save this as element-shot.js. Replace the URL and selector with the page and element you need:

#1 Best Overall
Sale
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black
  • Compatible with Nintendo Switch 2’s new GameChat mode
  • Auto-Light Balance: RightLight boosts brightness by up to 50%, reducing shadows so you look your best—compared to previous-generation Logitech webcams (1)
  • Privacy with a Slide: The integrated webcam cover makes it easy to get total, reliable privacy when you're not on a video call
  • Built-In Mic: The built-in microphone lets others hear you clearly during video calls
  • Easy Plug-And-Play: The Brio 101 works with most video calling platforms, including Microsoft Teams, Zoom and Google Meet—no hassle; it just works
const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch({ headless: true });
  const page = await browser.newPage();

  try {
    await page.goto('https://example.com', { waitUntil: 'networkidle' });
    const element = page.locator('#pricing-card');
    await element.waitFor({ state: 'visible' });
    await element.screenshot({ path: 'element.png', type: 'png' });
  } finally {
    await browser.close();
  }
})();

Run it with node element-shot.js. The output is the visible rendered content of the selected element, not a screenshot of the whole document. Use a selector that identifies exactly one intended element; if the selector matches more than one, make it specific or select the intended match explicitly.

Format, scale, and full-page behavior

  • Format: PNG is the default and preserves sharp edges; JPEG is useful when a smaller lossy image is acceptable; WebP is also supported. Set type to 'jpeg' or 'webp' and choose a matching filename extension.
  • Scale: Playwright supports CSS-pixel sizing and device-pixel-ratio scaling for element screenshots. Choose the scale based on whether the output should match CSS layout dimensions or retain higher-density pixels.
  • Full page: Full-page capture is a page screenshot mode, not an option to combine with an element target. If you need a long element, make sure its content is rendered and visible, then capture the element itself; do not expect fullPage to extend an element screenshot.

Screenshot images are useful for visual layout checks, charts or canvas output, and bug reports. If the goal is to inspect page structure or read text, use an accessibility or DOM-oriented inspection instead of treating pixels as the source of truth. See Playwright’s screenshot documentation.

Rank #2
Sale
Logitech C270 720p Webcam Plug-and-Play Wide Screen Video Calling - Black
  • Compatible with Nintendo Switch 2’s new GameChat mode
  • Crisp HD 720p/30 fps video calls with diagonal 55° field of view and auto light correction. Compatible with popular platforms including Skype and Zoom.
  • The built-in noise-reducing mic makes sure your voice comes across clearly up to 1.5 meters away, even if you’re in busy surroundings.
  • C270’s RightLight 2 feature adjusts to lighting conditions, producing brighter, contrasted images to help you look good in all your conference calls.
  • The adjustable universal clip lets you attach the camera securely to your screen or laptop, or fold the clip and set the webcam on a shelf. You’re always ready for your next video call.

Choose the right Chromium capture route

Need Use What it produces
A saved PNG, JPEG, or WebP of one element Playwright element screenshot A still image written by browser automation
A live shared or recorded region of a tab Chrome Element Capture API A video track restricted to an element and its descendants
Extension-level, lower-level debugging control Chrome extension debugger API and CDP A debugging transport; additional CDP implementation is needed for a capture recipe

Use Chrome Element Capture for a live video region

Chrome’s Element Capture API is not the ordinary answer when you want to save one screenshot file. It is designed to crop a live tab-capture video track to a selected element and its descendants. Chrome for Developers describes it this way: “The Element Capture API lets you capture and record a specific HTML element.” The documentation says it is available from Chrome 132 on desktop and currently enabled only for self-capture. See Chrome’s Element Capture guide.

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.

Basic API flow

  1. Start tab capture with navigator.mediaDevices.getDisplayMedia({ preferCurrentTab: true }).
  2. Get the video track from the returned stream.
  3. Create a restriction target from the desired element with RestrictionTarget.fromElement(element).
  4. Apply it to the video track with track.restrictTo(restrictionTarget).

Feature-detect both RestrictionTarget and RestrictionTarget.fromElement before relying on the flow. This API changes the frames emitted by a live track; it does not provide the same saved-file workflow as Playwright’s element screenshot method.

Rank #3
Sale
NexiGo N60 1080P Webcam with Microphone, Software Control & Privacy Cover, USB HD Computer Web Camera, Plug and Play, for Zoom/Skype/Teams, Conferencing and Video Calling
  • 【Full HD 1080P Webcam】Powered by a 1080p FHD two-MP CMOS, the NexiGo N60 Webcam produces exceptionally sharp and clear videos at resolutions up to 1920 x 1080 with 30fps. The 3.6mm glass lens provides a crisp image at fixed distances and is optimized between 19.6 inches to 13 feet, making it ideal for almost any indoor use.
  • 【Wide Compatibility】Works with USB 2.0/3.0, no additional drivers required. Ready to use in approximately one minute or less on any compatible device. Compatible with Mac OS X 10.7 and higher / Windows 7, 8, 10 & 11 / Android 4.0 or higher / Linux 2.6.24 / Chrome OS 29.0.1547 / Ubuntu Version 10.04 or above. Not compatible with XBOX/PS4/PS5.
  • 【Built-in Noise-Cancelling Microphone】The built-in noise-canceling microphone reduces ambient noise to enhance the sound quality of your video. Great for Zoom / Facetime / Video Calling / OBS / Twitch / Facebook / YouTube / Conferencing / Gaming / Streaming / Recording / Online School.
  • 【USB Webcam with Privacy Protection Cover】The privacy cover blocks the lens when the webcam is not in use. It's perfect to help provide security and peace of mind to anyone, from individuals to large companies. 【Note:】Please contact our support for firmware update if you have noticed any audio delays.
  • 【Wide Compatibility】Works with USB 2.0/3.0, no additional drivers required. Ready to use in approximately one minute or less on any compatible device. Compatible with Mac OS X 10.7 and higher / Windows 7, 10 & 11, Pro / Android 4.0 or higher / Linux 2.6.24 / Chrome OS 29.0.1547 / Ubuntu Version 10.04 or above. Not compatible with XBOX/PS4/PS5.

Element Capture eligibility and limits

  • The track must be a self-capture video track. Chrome lists attempts involving a different tab, a missing originating element, a non-self-capture track, cloned tracks, or an ineligible element as failure cases.
  • The target should be a cohesive, two-dimensional rectangular area whose pixels can be determined independently of its parents and siblings, and it should form its own stacking context. Chrome suggests isolation: isolate as one way to create that context.
  • An element or ancestor with display: none is an example of an ineligible target. If CSS changes make the target ineligible, new frames stop until it becomes eligible again.
  • Restricted frames include the target and descendants while excluding siblings and content that occludes or is occluded by it.
  • The live video has no alpha channel. Transparent pixels can therefore appear differently, including as black regions; check the actual stream rather than assuming the result is a transparent still image.

When an extension or CDP approach makes sense

Chrome documents chrome.debugger as an extension transport for the Chrome DevTools Protocol. It requires declaring the debugger permission, but the Chrome reference does not provide an element-screenshot recipe. Treat this as a lower-level route if your extension needs CDP control and you are prepared to implement the capture details, rather than as a simpler substitute for Playwright. See Chrome’s debugger API reference.

On managed devices, enterprise policy or data-loss-prevention restrictions may block debugger attachment. Chrome documents screenshot-restriction errors associated with the DisableScreenshots policy or DLP controls; page code cannot override an organization-level restriction.

Rank #4
Sale
EMEET C960 1080P Webcam with Microphone, 2 Mics, 90° FOV, Computer Camera
  • 1080P Webcam with Cover for Video Calls - EMEET computer webcam provides design and Optimization for professional video streaming. Realistic 1920 x 1080p video, 5-layer anti-glare lens, providing smooth video. C960 computer camera delivers 1920x1080 video with fixed focus (11.8–118.1 inches), so as to provide a clearer image. C960 USB webcam has a cover and can be removed automatically to meet your needs for privacy. For optimal image performance, use the webcam in a well-lit environment.
  • Built-in 2 Omnidirectional Mics - EMEET webcam with microphone for desktop features 2 built-in omnidirectional microphones, picking up your voice to create clear audio for communication. When installing the webcam, select EMEET C960 as the default microphone input device in your computer and video applications and select C960 as the default device in Zoom/Teams and ensure microphone permissions are enabled for proper use. Please note that C960 does not include built-in speakers.
  • Automatic Light Adjustment - Automatic exposure adjustment is applied in EMEET HD webcam 1080p so that the streaming webcam can deliver stable image performance. EMEET C960 camera for computer also features color adjustment and exposure optimization to help you look your best. For optimal video quality, it is recommended to use the webcam in normal or well-lit environments and select suitable video settings in your application. Proper lighting helps achieve a clearer and more balanced image.
  • Plug-and-Play & Upgraded USB Connectivity - New C960 webcam features both USB Type-A & A-to-C adapter connections for wider compatibility. For stable performance, connect the webcam directly to the computer's main USB port and ensure the device is recognized correctly. If a hub or docking station is used, please ensure it provides sufficient power and stable data transmission, as limited ports may affect performance. 90° wide-angle lens captures more participants without frequent adjustments.
  • High Compatibility & Multi Application - C960 webcam for laptop is compatible with Windows 10/11, macOS 10.14+, and Android TV 7.0+. Not supported: Windows Hello, TVs, tablets, or game consoles. It works with Zoom, Teams, Facetime, Google Meet, YouTube and more. Please select C960 webcam as the default camera and microphone device in your application and ensure camera/microphone permissions are enabled, especially on macOS. (Tips: Incompatible with Windows Hello)
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot missing or incorrect output

The Playwright image is empty or the element is missing

  • Confirm the page loaded the expected URL and that the selector matches the current DOM.
  • Wait for the element to become visible, as in the example, and account for content that appears only after application-specific loading or interaction.
  • For lazy-loaded images or content, scroll the relevant region into view or otherwise trigger the page’s loading behavior before capturing.

The capture is of the wrong area or size

  • Check that the selector identifies the intended element rather than a parent container or repeated match.
  • Decide whether you need CSS-pixel dimensions or device-pixel-ratio scaling; those produce different pixel dimensions.
  • Do not combine element targeting with full-page capture. They represent different screenshot targets.

Element Capture stops producing frames

  • Verify the target still exists in the same tab where the restriction target was created, and that the track is an eligible self-capture track without clones.
  • Check the element and its ancestors for display: none and confirm the target still has suitable geometry and stacking context.
  • Inspect the rendered stream for color changes around transparency; the capture is not alpha-preserving.

An extension cannot attach the debugger

Confirm the extension declares the debugger permission. If Chrome reports screenshot restrictions on a managed device, check with the administrator about enterprise screenshot policy or DLP rather than repeatedly changing page code.

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

Or skip the browser setup

For a website screenshot without installing or running browser automation yourself, ScreenshotNeo offers a screenshot API with CSS-selector element capture. Its available options include full-page capture, output formats, viewport and device presets, and custom CSS or JavaScript. The example below makes a one-call website capture; it captures the supplied URL and does not specify an element selector.

Best Value
Logitech C920x HD Pro PC Webcam Full 1080p/30fps Video - Black
  • Compatible with Nintendo Switch 2’s new GameChat mode
  • HD lighting adjustment and autofocus: The Logitech webcam automatically fine-tunes the lighting, producing bright, razor-sharp images even in low-light settings. This makes it a great webcam for streaming and an ideal web camera for laptop use
  • Advanced capture software: Easily create and share video content with this Logitech camera that is suitable for use as a desktop computer camera or a monitor webcam
  • Stereo audio with dual mics: Capture natural sound during calls and recorded videos with this 1080p webcam, great as a video conference camera or a computer webcam
  • Full HD 1080p video calling and recording at 30 fps. You'll make a strong impression with this PC webcam that features crisp, clearly detailed, and vibrantly colored video
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for the API’s selector parameter and other options. Cookie or consent banners, newsletter popups, and chat widgets are removed before the shot; those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. ScreenshotNeo also provides an MCP server with screenshot tools for AI agents. The free plan includes 1,000 shots a month with no card; paid plans start at $5 for 3,000 shots.

Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.

Frequently Asked Questions

Does Playwright’s screenshot method save an element as an image file?

Yes. Passing an element locator to its screenshot method can write a still image to the path you specify, in a supported image format.

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

Does Chrome Element Capture work in every Chromium browser?

The cited Chrome documentation specifies availability from Chrome 132 on desktop and says it is currently enabled only for self-capture; it does not establish equivalent availability across all Chromium-based browsers.

Quick Recap

SaleBestseller No. 1
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black
Compatible with Nintendo Switch 2’s new GameChat mode; Built-In Mic: The built-in microphone lets others hear you clearly during video calls
$35.80
SaleBestseller No. 2
Logitech C270 720p Webcam Plug-and-Play Wide Screen Video Calling - Black
Logitech C270 720p Webcam Plug-and-Play Wide Screen Video Calling - Black
Compatible with Nintendo Switch 2’s new GameChat mode
$16.89
Bestseller No. 5
Logitech C920x HD Pro PC Webcam Full 1080p/30fps Video - Black
Logitech C920x HD Pro PC Webcam Full 1080p/30fps Video - Black
Compatible with Nintendo Switch 2’s new GameChat mode; Fully compatible with Windows 11
$69.99

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.