Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteSome links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
For a quick image generated inside a web page, use html2canvas. For a screenshot of the browser’s actual rendered pixels—especially in Node.js, tests, or server-side work—use Playwright to capture a locator. These approaches are not equivalent: html2canvas reconstructs an image from DOM and style information, while Playwright asks a browser to capture the element region.
Choose the right kind of element screenshot
| Need | Starting point | What to know |
|---|---|---|
| Create an image from code running in the page | html2canvas | It rebuilds the appearance from information it can read; the result may differ from the browser’s rendered pixels. |
| Capture an element in browser automation or a test | Playwright locator screenshot | The browser captures the element region after scrolling it into view and completing actionability checks. Overlays and scroll position affect the result. |
| Capture a clipped region using a lower-level Chromium interface | Chrome DevTools Protocol (CDP) | Page.captureScreenshot supports a clip and returns base64-encoded image data. |
| Capture from a Node.js process | Playwright or another browser automation tool | html2canvas depends on browser globals such as window and document; it is not a Node.js renderer. |
Choose based on where the code runs, whether you need rendered pixels or a DOM-based reconstruction, whether the target includes cross-origin content, and whether the caller needs a file, a data URL, or bytes.
Capture a DOM node in a browser with html2canvas
Use this route when the code runs in a browser page and you can accept a reconstructed image rather than a native browser screenshot. The example selects one element, creates a canvas, and downloads it as a PNG.
import html2canvas from 'html2canvas';
async function downloadNodeScreenshot(selector) {
const node = document.querySelector(selector);
if (!node) {
throw new Error(`No element matches ${selector}`);
}
const canvas = await html2canvas(node);
const link = document.createElement('a');
link.download = 'element.png';
link.href = canvas.toDataURL('image/png');
link.click();
}
downloadNodeScreenshot('#report-card').catch(console.error);
Load html2canvas using the installation method appropriate to your project, or include its browser build before this code. The function rejects if the selector matches nothing or image generation fails, so the caller can report the problem instead of silently producing no file.
#1 Best Overall
- 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
Return a data URL or canvas instead of downloading
If another part of the page needs the result, return the canvas or a data URL:
async function nodeToDataUrl(node) {
const canvas = await html2canvas(node);
return canvas.toDataURL('image/png');
}
const node = document.querySelector('.chart');
if (!node) throw new Error('Chart element was not found');
const imageUrl = await nodeToDataUrl(node);
document.querySelector('#preview').src = imageUrl;
For a binary representation, use canvas.toBlob() rather than a large base64 string:
function canvasToBlob(canvas, type = 'image/png') {
return new Promise((resolve, reject) => {
canvas.toBlob(blob => {
if (blob) resolve(blob);
else reject(new Error('Canvas could not be encoded'));
}, type);
});
}
const canvas = await html2canvas(document.querySelector('.chart'));
const blob = await canvasToBlob(canvas);
// `blob` can be uploaded with FormData or used in an object URL.
What html2canvas does—and does not do
html2canvas traverses DOM and style information to build a representation; its documentation explicitly says it does not make an actual screenshot. Unsupported CSS, browser-specific rendering details, fonts, and unreadable resources can therefore produce differences from what a user sees. It documents support for modern evergreen browsers including Firefox, Chrome and Chromium-based browsers, and Safari. See the project’s documentation for the current support details.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Rank #2
- 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
Images generally need to be same-origin unless a proxy makes them readable. Cross-origin iframes cannot be rendered because browser security prevents access to their contentDocument; sandboxed frames without allow-same-origin have a similar constraint. Cross-origin content can also taint a canvas, preventing it from being read or encoded. These restrictions are browser security boundaries, not selector bugs.
Capture an element’s rendered pixels with Playwright
For server-side work or an automated screenshot, launch a browser and use a locator’s screenshot() method. This JavaScript example captures the selected element to a PNG file. Install Playwright and its browser binaries in the project before running it.
import { chromium } from 'playwright';
const browser = await chromium.launch();
try {
const page = await browser.newPage();
await page.goto('https://example.com', { waitUntil: 'load' });
const card = page.locator('.report-card');
await card.screenshot({ path: 'report-card.png' });
} finally {
await browser.close();
}
Playwright’s documented locator screenshot flow waits for actionability checks, scrolls the element into view, captures a clip corresponding to it, and returns image bytes. The file-path form writes those bytes to disk; omit path and retain the return value when the application needs bytes for an upload or response. Consult the Playwright screenshots guide and the installed release’s API documentation for available language-specific options.
Rank #3
- 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.
Control the page before capture
Navigate to the target state and wait for the content you need before taking the screenshot. For dynamic pages, waiting for the target locator is more reliable than assuming a fixed delay:
await page.goto('https://example.com/dashboard');
const chart = page.locator('[data-testid="chart"]');
await chart.waitFor({ state: 'visible' });
const imageBytes = await chart.screenshot();
If an animation or loading state changes the image, arrange the page’s state before capture and check the current Playwright release documentation for screenshot options that suit your test. Do not treat a fixed sleep as proof that all assets have loaded.
Visibility and scrolling caveats
An element screenshot reflects the region as it appears at capture time. If a banner, modal, or other element covers the target, the screenshot can show that obstruction rather than revealing what is underneath. A scrollable container contributes only the content currently scrolled into view; an element screenshot is not automatically a capture of every offscreen item in that container. Scroll the relevant container or change the page state first when you need different content.
Use Chrome DevTools Protocol for a clipped capture
CDP is a lower-level option when you already control a Chromium debugging or automation connection. The Page domain’s Page.captureScreenshot command accepts PNG, JPEG, or WebP output and a clip viewport for a region; the response image is base64-encoded. It is not ordinary JavaScript running in a page: a client must send the protocol command to a browser session and decode the returned data.
Rank #4
- 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
Use a higher-level locator API such as Playwright when the main job is selecting an element and handling browser interaction. CDP is useful when the client needs the protocol’s page-level capture controls. The protocol definition is documented at Chrome DevTools Protocol: Page; protocol fields can evolve, so match the command to the browser and client version in use.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server for developers. Its one-request endpoint can return an image or PDF, and it can capture a selected element using a CSS selector. It captures a web page from a browser rather than running html2canvas against a DOM node already open in your user’s page, so it is a practical alternative when you need a hosted capture of a URL.
For example, capture a page as WebP with cURL:
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 authentication and request options. The service removes cookie banners, newsletter popups, and chat widgets before capture; each step 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. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients. The free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month with no card.
Best Value
- 【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.
Troubleshoot common capture failures
The selector does not match anything
- Symptom: the browser function reports that no element exists, or Playwright times out waiting for a locator.
- Cause: the selector is wrong, the page has not rendered the target yet, or the element is inside a frame.
- Fix: inspect the live DOM, use a stable selector, and wait for the target’s visible state. For a frame, locate the content through the frame API rather than querying the top-level document.
html2canvas output is missing images or differs from the page
- Cause: the renderer cannot read a cross-origin image or iframe, the canvas is tainted, or the page uses rendering features it does not reproduce.
- Fix: serve assets from the same origin or use an appropriate proxy, avoid inaccessible cross-origin frames, and compare the result against the source page in a supported browser. If actual browser pixels are required, switch to browser automation.
The Playwright image shows an overlay or only part of a scroll area
- Cause: another element covers the target, or the scroll container is positioned so the rest of its content is offscreen.
- Fix: dismiss or reposition the overlay and scroll the relevant container to the desired content before taking the screenshot.
html2canvas fails in Node.js with missing browser globals
- Cause: Node.js does not provide the page’s
windowanddocumentobjects. - Fix: run html2canvas in an actual browser page, or use Playwright or another browser automation tool for server-side rendering.
The output cannot be encoded or is unexpectedly empty
- Cause: a cross-origin resource may have tainted the canvas, the element may have no rendered size, or capture may have occurred before the content appeared.
- Fix: verify the element’s dimensions and visible state, resolve resource-origin restrictions, and handle failed canvas encoding explicitly rather than assuming the result is valid.
Practical reliability and cost considerations
For client-side capture, rendering and encoding happen in the visitor’s browser; large elements or high-resolution canvases can consume memory and processing time. Keep the target region limited to what the user needs and prefer a blob for binary upload rather than converting a large image to a base64 string. These are implementation considerations, not a published performance benchmark.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsFor Playwright, browser startup and page loading are part of the work, so reuse a controlled browser process when your application’s architecture permits it, and close pages and browsers when finished. Make screenshots deterministic by stabilizing page state, fonts, assets, and overlays. A successful screenshot call means an image was captured; it does not itself prove that the page visually matches an expected result.
For recurring captures, estimate volume using your actual capture frequency and output needs. The hosted ScreenshotNeo plans above distinguish monthly shot allowances; browser automation instead entails operating the browser environment yourself. The choice is therefore not simply image quality: it includes where execution occurs, what cross-origin material is accessible, how much state control you need, and whether you want to run and maintain a browser.
Frequently Asked Questions
Can I capture a DOM element without saving a file?
Yes. html2canvas returns a canvas that you can convert to a data URL or Blob, while Playwright’s locator screenshot method returns image bytes when you do not supply a file path.
Does html2canvas take a real screenshot?
No. It reconstructs an image from DOM and style information; it does not capture the browser’s actual rendered pixels.
Can html2canvas capture an element inside a cross-origin iframe?
No. Browser security restrictions prevent access to a cross-origin frame’s document, so html2canvas cannot render its contents.
Quick Recap
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.

