For a screenshot of an Electron app’s rendered page, use webContents.capturePage(). For repeatable screenshots in an automated test, use Playwright’s Electron API and window.screenshot(). If you need an image or video source for an entire display or another desktop window, use Electron’s desktopCapturer media-capture flow instead. These APIs solve different problems: a page snapshot is not automatically a screenshot of the operating-system desktop.
Choose the capture method that matches your goal
| Goal | Use | What it captures |
|---|---|---|
Save the rendered content of an Electron WebContents |
webContents.capturePage([rect, options]) |
The visible page, optionally limited to a rectangle; resolves to a NativeImage. |
| Create a screenshot as part of a repeatable test | Playwright Electron API and window.screenshot({ path }) |
An Electron window controlled by the test runner. |
| Capture a monitor or another desktop window as media | desktopCapturer.getSources() plus the browser media-capture flow |
Screen and window media sources, suitable for sharing or recording. |
The rest of this guide shows each approach, when to use it, and how to troubleshoot the common failure modes.
Capture an Electron page with webContents.capturePage
capturePage is the direct Electron API for a page snapshot. Call it on the target window’s webContents. Omit the rectangle to capture the whole visible page, or provide a rectangle to capture only a region. The promise resolves to a NativeImage, which can then be written to disk in PNG, JPEG, or another representation supported by your Electron version.
Capture the whole visible page
Run this in the main process after the BrowserWindow has loaded the page you want:
Outdated 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 matchPC 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 & 11#1 Best Overall
- 【1080P 60FPS Video Capture Card】 This HDMI game capture card is based on USB3.0 high speed transmission port, input resolution up to 4K@30HZ, output resolution up to 2K@30Hz or 1920×1080@60Hz. Type c and USB interface can meet most of the devices in daily life. Easily meet the online capture, real-time recording, online meetings, live gaming and other functions, so you have a better visual enjoyment. Note: For capture use only; requires capture software to function and is not intended for direct screen casting to a monitor or TV
- 【Ultra Low Latency Screen Sharing】 HDMI capture card is made of good quality aluminum alloy with strong heat dissipation, allowing you to enjoy ultra low latency while live gaming or video recording or live streaming, avoiding blue screens and lag. This HDMI to USBC capture card supports easy recording of good quality audio or HD video and transferring it to your computer or streaming platform, allowing you to record 60 fps HD video directly on your hard drive and real-time preview
- 【Plug and Play, Easy to Carry】 This HDMI 1080P video capture card does not require any additional drivers or external power supply, just plug and play for fast capture. The capture card is small and lightweight, so you can put it in your bag for emergencies, making it very portable for outdoor live streaming. It's also a great way to share content in game recording, video conference, video recorder and online teaching
- 【Wide Compatibility USB Capture Card】 Easily streams to Facebook, Youtube or Twitch. With the connection, this HDMI to USB C/3.0 video capture devices can be working on several Operating Systems and various software: Windows 7/ 8/ 10, Mac OS or above, Linux, Android, Laptop, Xbox One, PS3/PS4/PS5, Camera, DVDs, Set Top Box, Webcame, DSLR, Switch/Switch 2, TV BOX, HDTV, Potplayer/VLC, ZOOM, OBS Studio etc.
- 【Package Content & Note】 1x HD Audio Capture Card , 1x USB 3.0 to USB C Adapter (A-side 3.0, B-side 2.0), 1x user manual. Please note that you need to restart the OBS Studio software after the audio setup is complete, otherwise it will result in no sound output. When using an adapter, if the device is recognized as USB 2.0, try using the other side with the USB-C port. Simply flip the capture card and reconnect it to be recognized as USB 3.0
const { app, BrowserWindow } = require('electron');
const fs = require('node:fs/promises');
const path = require('node:path');
async function savePageScreenshot(win) {
const image = await win.webContents.capturePage();
const output = path.join(app.getPath('pictures'), 'electron-page.png');
await fs.writeFile(output, image.toPNG());
return output;
}
app.whenReady().then(async () => {
const win = new BrowserWindow({ width: 1280, height: 800 });
await win.loadURL('https://example.com');
const output = await savePageScreenshot(win);
console.log(`Saved ${output}`);
});
Wait for the page to finish the state you want before calling the method. If the application renders content after navigation, wait for that application state rather than assuming that the initial load event means every component is ready.
Capture a rectangle
Pass a rectangle when a full page image contains unwanted areas or when you need a specific panel. The rectangle is evaluated in the page’s coordinate space:
const { app, BrowserWindow } = require('electron');
const fs = require('node:fs/promises');
const path = require('node:path');
app.whenReady().then(async () => {
const win = new BrowserWindow({ width: 1280, height: 800 });
await win.loadFile('index.html');
const rect = { x: 80, y: 120, width: 760, height: 460 };
const image = await win.webContents.capturePage(rect);
const output = path.join(app.getPath('pictures'), 'dashboard-panel.png');
await fs.writeFile(output, image.toPNG());
console.log(`Saved ${output}`);
});
A rectangle that extends beyond the visible content can produce an image different from what you expected. Start with the visible viewport, confirm the coordinates, and then adjust the region.
Options for hidden windows and power behavior
The API accepts options including stayHidden and stayAwake. These are useful when your capture workflow deliberately keeps a window hidden or must prevent the system from sleeping during a capture. Check the Electron API documentation for the exact behavior of the version you ship, because these are living APIs.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →What this method does not do
- It snapshots the rendered
WebContents; it does not enumerate monitors or arbitrary operating-system windows. - It is not a video stream and does not itself implement screen sharing.
- It does not turn a long, scrollable document into an automatically stitched full-page image; the documented behavior is the visible page (or the supplied rectangle).
Save screenshots in automated tests with Playwright
Playwright’s Electron API is the convenient route when a screenshot is a test artifact. The documented flow launches the Electron application, obtains its first window, and calls window.screenshot({ path: 'intro.png' }).
Rank #2
- 【4K HDMI Input, 2K@30Hz Recording】Powered by a true USB 3.0 high-speed interface, the capture card supports up to 4K@30Hz HDMI input and records at 2K@30Hz or 1080P@60Hz. Perfect for gamers, streamers, and professionals who need crisp, smooth video for live streaming, gameplay recording, or online meetings.
- 【Ultra Low Latency Screen Sharing】Built with a premium aluminum alloy shell and advanced chipset for stable heat dissipation, ensuring ultra-low latency transmission. Capture high-quality video and dual-channel audio in real time—no lag, no frame drop—ideal for Twitch, YouTube, or OBS streaming.
- 【Easy Plug and Play, Compact & Portable】No driver or external power required—just plug and play via USB 3.0 or Type-C connection to your Windows or macOS computer. Lightweight and compact design makes it easy to carry for outdoor streaming, live shows, or mobile recording setups.
- 【Wide Compatibility & Multi-Device Support】Compatible with Windows 7 8 10 11, macOS, Linux,Android and supports most popular software such as OBS, Zoom, VLC, Twitch Studio, and more. Works seamlessly with PS4, PS5, Xbox, Switch, DSLR cameras, TV boxes, and other HDMI-output devices for streaming to YouTube, Twitch, etc.
- 【What You Get】Includes: HDMI Capture Card, USB 3.0 to USB-C Adapter, User Manual. Tips: Make sure your tablet’s OTG function is enabled before connecting. Test your HDMI device with a monitor first to confirm video and audio output, then connect to the Video Capture Card for recording.
Minimal test example
const { _electron: electron } = require('playwright');
(async () => {
const app = await electron.launch({ args: ['.'] });
try {
const window = await app.firstWindow();
await window.screenshot({ path: 'intro.png' });
} finally {
await app.close();
}
})();
Replace '.' with the path or launch arguments for your Electron application. In a real test, perform the navigation and user actions that establish the state you want before taking the screenshot. Keep the output path in the test artifact directory used by your CI system.
Make the image deterministic
- Use the same application seed and fixture data for every run.
- Wait for the relevant window or UI state instead of taking the image immediately after launch.
- Keep viewport and display settings consistent across local and CI environments.
- Use stable selectors and hide data that changes on every run, such as timestamps, before capture.
Playwright’s documented Electron automation does not intercept native Electron dialogs that go directly to operating-system APIs. If your test depends on a native dialog, handle it through the operating system or redesign that part of the test rather than expecting a page locator to control it.
Capture a screen or window with desktopCapturer
Use desktopCapturer when the requirement is screen-sharing, recording, or capturing a desktop window as a media source. Call desktopCapturer.getSources() and choose a source by its type and identity. Electron documents screen and window sources; source objects expose IDs, names, and thumbnails.
Enumerate available sources
const { desktopCapturer } = require('electron');
async function listCaptureSources() {
const sources = await desktopCapturer.getSources({
types: ['screen', 'window'],
thumbnailSize: { width: 320, height: 200 }
});
return sources.map(source => ({
id: source.id,
name: source.name,
thumbnail: source.thumbnail
}));
}
listCaptureSources().then(console.log).catch(console.error);
A screen source is named “Entire Screen” or “Screen <index>”; a window source name matches its window title. Thumbnail dimensions are not guaranteed to equal the requested size because the actual dimensions depend on display and window scaling.
Platform permission on macOS
Electron documents user consent for screen-content capture on macOS 10.15 Catalina and later. Check the status with systemPreferences.getMediaAccessStatus and provide a clear path for the user to grant access. Permission behavior differs by operating system, so do not assume that a workflow that succeeds on one platform will behave identically elsewhere.
Rank #3
- 【1080P HD High Quality】Capture resolution up to 1080p for video source and it is ideal for all HDMI devices such as PS4, PS3, Xbox One, Xbox 360, Wii U, DVDs, DSLR, Camera, Security Camera and set top box. Note: Video input supports 4K30/60Hz and 1080p120/144Hz. Does not support 4K120Hz/144Hz. Output supports up to 2K30Hz.
- 【Plug and Play】No driver or external power supply required, true PnP. Once plugged in, the device is identified automatically as a webcam. Detect input and adjust output automatically. Won't occupy CPU, optional audio capture. No freeze with correct setting.
- 【Compatible with Multiple Systems】suitable for Windows and Mac OS. High speed USB 3.0 technology and superior low latency technology makes it easier for you to transmit live streaming to Twitch, Youtube, Facebook, Twitter, OBS, Potplayer and VLC.
- 【HDMI LOOP-OUT】Based on the high-speed USB 3.0 technology, it can capture one single channel HD HDMI video signal. There is no delay when you are playing game live.
- 【Support Mic-in for Commentary】Rybozen capture card has microphone input and you can use it to add external commentary when playing a game. Please note: it only accepts 3.5mm TRS standard microphone headset.
Common errors and fixes
The screenshot is blank or shows the wrong state
Cause: capture ran before the page finished rendering, or the application displays content asynchronously.
Fix: wait for the application’s ready condition, then call capturePage or Playwright’s screenshot method. For tests, wait for a specific window or UI state rather than relying only on process startup.
The crop is offset or clipped
Cause: the rectangle coordinates do not match the current viewport or scaling.
Fix: verify the window size and coordinate origin, capture the whole visible page once, then derive and test the rectangle against that image.
No desktop source appears
Cause: the selected source type is wrong, the window title changed, or the operating system has denied screen access.
Rank #4
- [Enhanced 4K-1080P Video Capture Experience] Capture the Magic: Elevate your video recordings to new heights with our upgraded anti-static 1080P Video Capture Card. Immerse yourself in stunning visuals, supporting HDMI input at 4K 60FPS and USB output for capturing in 1080P, complete with rich stereo sound. Enjoy crystal-clear video recordings, dynamic gaming live streams, and professional conference broadcasts. Note: HDMI resolution: Max input can be 3840×2160@30Hz / Video output resolution: Max output can be 1920×1080@30Hz
- [Seamless Real-Time Preview] Stay in the Moment: Our advanced ultra-low latency technology ensures seamless real-time transmission of video streams. Experience instant, lag-free previews, allowing you to capture every detail precisely. Effortlessly record video directly to your hard disk, all without compromising on quality or introducing any delays.
- [Versatility and Broad Compatibility] Your Creative Hub: Connect your DSLR, camcorder, or action camera to a wide range of operating systems, including Windows, MacOS, and Linux. Unlock a world of possibilities with real-time streaming to popular platforms like Twitch, Youtube, OBS, Zoom, Potplayer, and VLC, giving you the tools to share your content effortlessly.
- [Effortless Plug and Play] Simplicity Redefined: Say goodbye to complex installations. Our plug-and-play design eliminates the need for drivers or external power supplies. Seamlessly integrate high-definition acquisition into various scenarios, whether it's educational recordings, immersive gaming, precise medical imaging, captivating live streams, or professional broadcasting.
- [Seize Every Detail with Precision] Unleash your creativity and attention to detail with our video capture card. Capture every nuance, every color, and every moment with precision, thanks to the enhanced capabilities of our technology. Whether you're a content creator, a gamer, or a professional, our capture card empowers you to seize the finest elements and bring them to life in your recordings and live streams.
Fix: enumerate both screen and window sources, log each source name and ID, and check macOS screen-content consent when applicable.
Free tools Windows power users keep installed
One-click scans. No signup required.
Playwright cannot control a dialog
Cause: the dialog is a native Electron or operating-system dialog, not page content.
Fix: use an operating-system-level test strategy for that dialog, or test the page-facing behavior separately. Playwright’s documented Electron flow does not intercept native dialogs that go directly to OS APIs.
The file is not written
Cause: the output directory does not exist or the process lacks permission to write there.
Fix: use a known writable directory such as Electron’s pictures path or your test runner’s artifact directory, and handle file-system errors so the test reports the real path and cause.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesBest Value
- 【1080P 60FPS & 2K 30FPS】Supports HDMI input up to 4K 30FPS for ultra‑clear source signals, and captures/streams smooth footage at max 1080P 60FPS or 2K 60FPS to eliminate motion blur and stuttering, delivering fluid visuals for gaming, live streaming and video recording via high‑speed USB 3.0 transmission.
- 【USB 3.0 High-Speed Interface】USB 3.0 interface with up to 5Gbps bandwidth for lag-free HD capture and streaming with consoles, cameras, desktops, and laptops. Aluminum casing dissipates heat effectively, ensuring stable performance under prolonged high-bandwidth loads. Note: For best results, use a USB 3.0 port.
- 【Easy Plug-and-Play design】with no additional driver software required. The 2-in-1 USB-A & Type-C interface design ensures wide compatibility with laptops, desktops, gaming consoles and mobile devices. Its compact and lightweight construction enhances portability, allowing you to carry and use it effortlessly anytime and anywhere.
- 【Wide Universal Compatibility】Works with diverse devices: laptops, tablets, PS4/PS5, Nintendo Switch, cameras, TV boxes, and Oculus Quest 2/3. It supports major operating systems: Windows 7/8/8.1/10, Mac OS, Linux, Android, and iPadOS 17+. Fully compatible with popular software and streaming platforms like OBS Studio, QuickTime Player, TikTok, Twitch, and YouTube—all without requiring drivers.
- 【Worry-Free After-Sales Support】Whether you're a newcomer or a seasoned user, feel free to reach out anytime with any questions—your satisfaction is our top priority. NOTE: This capture card supports one-way transmission only (HDMI to USB), and ensure your device is equipped with a USB 3.0 port to achieve optimal performance.
Reliability and performance choices
- Capture only what you need. A rectangle reduces the image area and makes downstream comparison easier.
- Reuse a window for test suites. Launching once and closing in a controlled fixture avoids unnecessary startup work, while each test should still reset its data.
- Keep source enumeration separate from capture. Enumerate desktop sources when the user starts sharing, then retain the selected source ID for the media flow.
- Account for scaling. Screen and window thumbnails can have dimensions different from the requested thumbnail size.
- Record failures. Save logs with the requested rectangle, window state, selected source, and output path so a failed capture can be reproduced.
Or skip the browser setup
If your real goal is a URL screenshot rather than a screenshot of a locally running Electron window, ScreenshotNeo provides a single HTTP request that returns PNG, JPEG, WebP, or PDF. It accepts cookie and consent banners as a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots.
See the ScreenshotNeo documentation for all options. A direct call looks like this:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
The same request in Python:
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
timeout=90,
)
open("shot.webp", "wb").write(r.content)
And in Node.js:
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
const body = Buffer.from(await res.arrayBuffer());
require('node:fs').writeFileSync('shot.webp', body);
Start with the free ScreenshotNeo sign-up to get 1,000 screenshots a month without a card.
Frequently Asked Questions
Can capturePage take a screenshot of an entire monitor?
No. It snapshots a WebContents page. Use desktopCapturer and the media-capture flow when the requirement is a display or desktop-window source.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Which method is best for visual regression artifacts?
Use Playwright’s Electron API so the application can be launched and the same window state can be captured repeatedly in a test.
Why do desktop thumbnails differ in size from my requested dimensions?
Electron notes that actual thumbnail dimensions depend on screen or window scaling, so the requested size is not a guarantee.
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.

