The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
The error means dom-to-image received something that is not one actual browser DOM node. Pass a mounted Element (or another DOM Node), not a jQuery or Angular collection, a React element, parser output, a selector string, or null. Select the element, verify it exists, unwrap collections with [0], and capture only after the UI has rendered.
What dom-to-image expects
dom-to-image’s top-level render functions—toPng, toBlob, toJpeg, toSvg, and toPixelData—accept a DOM node and rendering options. The implementation recursively clones the supplied node, copies computed styles, embeds fonts and images, serializes the result, and uses SVG foreignObject for raster output.
That makes these calls valid when the target is mounted:
const node = document.getElementById('invoice');
if (!node) {
throw new Error('Capture target not found');
}
domtoimage.toPng(node)
.then((dataUrl) => {
const image = document.createElement('img');
image.src = dataUrl;
document.body.appendChild(image);
})
.catch(console.error);
The value passed to toPng is the important part. A selector, collection, component description, or missing result is not interchangeable with the node itself.
#1 Best Overall
- 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
Fix the argument step by step
1. Select one element
Use an API that returns a single node and check it before capture:
const node = document.querySelector('#invoice');
if (!(node instanceof Element)) {
throw new Error('Expected one mounted Element');
}
const blob = await domtoimage.toBlob(node);
querySelector returns the first match. If you need to enforce a unique target, check the count explicitly:
const matches = document.querySelectorAll('.invoice');
if (matches.length !== 1) {
throw new Error(`Expected exactly one .invoice, found ${matches.length}`);
}
const node = matches[0];
await domtoimage.toPng(node);
2. Correct an ID/class mismatch
getElementById('whole_page') returns null unless the markup contains id="whole_page". A class with that name requires a class selector:
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 →<div class="whole_page">...</div>
const node = document.querySelector('.whole_page');
// or, for the older collection API:
const node = document.getElementsByClassName('whole_page')[0];
Always test the result. Calling a library with null produces a misleading downstream error instead of identifying the selector problem.
Rank #2
- 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.
3. Unwrap jQuery and AngularJS collections
jQuery objects and AngularJS/jqLite wrappers are collection-like objects. They contain DOM nodes, but they are not themselves nodes with the interface dom-to-image clones.
// jQuery
const node = $('#invoice')[0];
if (!node) throw new Error('Invoice not found');
await domtoimage.toPng(node);
// AngularJS / jqLite
const node = angular.element('#invoice')[0];
if (!node) throw new Error('Invoice not found');
await domtoimage.toBlob(node);
Do not pass $('#invoice') or angular.element('#invoice') directly. If a collection can contain several matches, choose the intended index or reject ambiguous input.
4. Capture a mounted React node, not a React value
A React element, the result of html-react-parser, and other render descriptions are JavaScript values used to create UI. dom-to-image needs the browser node produced after React commits that UI.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
import { useRef } from 'react';
import domtoimage from 'dom-to-image';
export function Invoice({ content }) {
const captureRef = useRef(null);
async function savePng() {
const node = captureRef.current;
if (!node) throw new Error('Invoice has not mounted yet');
const dataUrl = await domtoimage.toPng(node);
const link = document.createElement('a');
link.download = 'invoice.png';
link.href = dataUrl;
link.click();
}
return (
<>
<div ref={captureRef} id="invoice">{content}</div>
<button type="button" onClick={savePng}>Save PNG</button>
</>
);
}
Calling the handler from a user action ensures the component is already mounted. For an automatic capture, wait until the relevant state has rendered, then wait for images or fonts as needed:
Rank #3
- 【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.
await document.fonts.ready;
const images = [...node.querySelectorAll('img')];
await Promise.all(images.map((img) => img.complete
? Promise.resolve()
: new Promise((resolve) => {
img.addEventListener('load', resolve, { once: true });
img.addEventListener('error', resolve, { once: true });
})));
await domtoimage.toPng(node);
Common causes and the precise correction
| Value you pass | Why it fails | Correction |
|---|---|---|
$('#element') |
jQuery wrapper, not an Element | Use $('#element')[0] |
angular.element('#element') |
AngularJS/jqLite wrapper | Use angular.element('#element')[0] |
document.querySelectorAll('.card') |
NodeList containing zero or many nodes | Choose one item, or iterate and capture each separately |
document.getElementById('whole_page') |
Markup has a class, not that ID | Use the matching ID or a class selector |
| React element or parser result | Virtual/render description, not mounted DOM | Attach a ref and use ref.current after render |
null or undefined |
Target is absent or capture runs too early | Fix the selector and mount timing |
A selector string such as '#card' |
dom-to-image does not query selectors itself | Resolve it with querySelector first |
When the error changes after you fix the node
Once the argument is a real node, a different failure usually concerns rendering rather than cloneNode.
SVG foreignObject and browser support
Rasterization relies on SVG foreignObject. Internet Explorer is unsupported because it lacks this capability. Safari has stricter foreignObject security and is also unsupported by the documented implementation; a server-side SVG rendering route is suggested for Safari workloads. Test the exact browser and deployment mode you support rather than assuming a successful Chrome capture transfers unchanged.
Fonts and images
Fonts that have not loaded can change text wrapping. Images may be missing if their requests are still pending, blocked, or inaccessible to the canvas. Wait for document.fonts.ready and image completion, and serve assets in a way the browser permits during canvas export.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchCross-origin canvas content
Images or canvases from another origin can taint the exported canvas when the server does not provide suitable cross-origin headers. The DOM can look correct on screen while export fails. Host assets on the same origin or configure the asset server for the required CORS policy; otherwise use a server-side capture path.
Rank #4
- 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)
Hidden, detached, or changing content
A detached node, a node inside a closed or not-yet-rendered state, or content that changes during cloning can produce blank or incomplete output. Capture a visible, mounted wrapper after the final state is committed. Avoid mutating that subtree until the promise resolves.
A reliable capture helper
Centralize validation so every call reports the real problem:
function requireElement(value, label = 'capture target') {
if (value == null) throw new Error(`${label} is null or undefined`);
const node = value.nodeType ? value : value[0];
if (!node || node.nodeType !== Node.ELEMENT_NODE) {
throw new TypeError(`${label} must be one DOM Element`);
}
return node;
}
async function pngFrom(value) {
const node = requireElement(value);
await document.fonts.ready;
return domtoimage.toPng(node);
}
pngFrom(document.querySelector('#invoice')).then((url) => {
document.querySelector('#preview').src = url;
});
The helper accepts a raw element and, when deliberately supported, a wrapper’s first item, while rejecting empty collections and unrelated objects.
Debugging checklist
- Log
value,value?.constructor?.name, andvalue?.nodeTypeimmediately before the dom-to-image call. - Confirm
node.nodeType === Node.ELEMENT_NODEand thatnode.isConnectedis true. - Check that the selector matches the actual
idorclassin rendered markup. - For collections, inspect
lengthand select one intended item. - In React, move capture into a click handler or an effect that runs after the target is rendered.
- After the type error is gone, inspect fonts, image requests, CORS, browser support, and
foreignObjectbehavior.
Or skip the browser setup
If your goal is a repeatable URL screenshot rather than client-side DOM export, ScreenshotNeo provides a website screenshot API and MCP server. One GET request captures a URL as PNG, JPEG, WebP, or PDF, without mounting React or passing a node.
Best Value
- 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
Example using cURL (see the ScreenshotNeo documentation for all options):
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Equivalent Python and Node.js calls
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 Bun.write('shot.webp', bytes);
ScreenshotNeo can accept cookie and consent banners before capture 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 the response identifies the page verdict and billing status in X-Page-Verdict and X-Billed headers. It also offers an MCP server with take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients.
Options cover full-page lazy-image loading, CSS-selector element capture, dark mode, device presets and custom viewports, retina scale, PDF paper and page controls, custom CSS or JavaScript, pre-capture clicks, hidden selectors, selector/delay/network-idle waits, request and resource blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, chosen-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. Its parameter names are compatible with those used by many other screenshot APIs.
Free tools Windows power users keep installed
One-click scans. No signup required.
The Free plan includes 1,000 shots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is included on every plan, and yearly billing provides two months free. Create a free ScreenshotNeo account.
FAQ
Can I pass a text node?
dom-to-image’s documented rendering entry points are intended for a DOM node representing the content to render. Wrap text in an element when you need predictable styling and export dimensions.
Why does the image look different from the page?
Export reproduces the state and resources available at capture time. Late-loading fonts, responsive dimensions, animations, and cross-origin assets can all produce differences; freeze the state and wait for resources before exporting.
Should I capture each match from a class selector?
Yes, but do it deliberately: convert the collection to an array, validate its length, and call the library once per element when separate images are required.
Recommended Free Tools
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.

