October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Chrome DevTools Protocol

How to Use Chrome Headless for Website Screenshots

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

To take a screenshot with Chrome Headless, run Chrome with --headless and --screenshot, and set a viewport with --window-size when you need predictable dimensions. For example: chrome --headless=new --screenshot --window-size=412,892 https://developer.chrome.com/. Chrome saves screenshot.png in the current working directory.

For repeatable captures in an application, use Puppeteer’s page.screenshot(). Choose the command line for a one-off capture, Puppeteer for JavaScript automation, CDP for direct protocol control, or Selenium if your existing automation already uses WebDriver.

Take a screenshot with Chrome’s command-line Headless mode

Chrome Headless runs Chrome without a visible browser window. The current unified Headless mode is the normal Chrome implementation: it shares Chrome code with headful mode, while omitting the visible UI. The --screenshot option captures the page and writes a PNG named screenshot.png in the directory from which you run the command.

  1. Check the Chrome executable name. Depending on your operating system and installation, the command may be chrome, google-chrome, or a full path to the Chrome executable.
  2. Run the capture command:
    chrome --headless=new --screenshot --window-size=412,892 https://developer.chrome.com/
  3. Find the result. Look for screenshot.png in the shell’s current working directory. If you omit --window-size, the output dimensions are not explicitly set by your command, so include it for deterministic viewport sizing.

The example uses --headless=new, the explicit spelling for the unified mode. Chrome’s current Headless documentation describes unified mode as the standard implementation; new work should use the current mode rather than depend on the separate legacy shell.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Guermok Video Capture Card, 4K USB3.0 HDMI to USB C, 1080P 60FPS & 2K 30FPS
  • 【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

Set viewport dimensions

--window-size=WIDTH,HEIGHT specifies the viewport in pixels. For example, --window-size=412,892 is a narrow, phone-sized viewport, but it does not itself emulate a particular phone, device pixel ratio, or mobile browser. Use it to control the page’s layout width and height for the capture.

Wait for dynamic content

A page may initially render a shell and fill in content after navigation. Chrome provides two different timing controls:

  • --timeout=5000 waits five seconds of real time before capturing. This is useful when you want to allow ordinary asynchronous activity time to complete.
  • --virtual-time-budget=5000 advances the page’s virtual clock by five seconds. Timer-driven scripts can observe that elapsed virtual time, without requiring the same five seconds to pass on the wall clock.

These are not interchangeable guarantees that every page has finished loading. A site may depend on network responses, user interaction, or other conditions. Choose a wait based on how the page produces its content, then inspect the resulting image.

Automate captures with Puppeteer

Puppeteer is a JavaScript library for automating Chrome and Firefox through CDP and WebDriver BiDi. Its high-level screenshot method is a practical choice when a script or service needs to navigate to pages and save images.

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 #2
Capture Card, 4K HDMI Video Capture Card, Game Capture Card, 1080P 60FPS Video Capture Device, HDMI to USB 3.0 Capture Card for Streaming, Work with Camera/Xbox/PS4/PS5/PC/OBS
  • 【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.
  1. Install Puppeteer in a Node.js project: npm install puppeteer.
  2. Save this as screenshot.mjs.
  3. Run it with node screenshot.mjs. The script writes example.png beside the script.
import puppeteer from 'puppeteer';

const browser = await puppeteer.launch({ headless: true });
try {
  const page = await browser.newPage();
  await page.setViewport({ width: 412, height: 892 });
  await page.goto('https://example.com', { waitUntil: 'networkidle2' });
  await page.screenshot({ path: 'example.png', fullPage: true });
} finally {
  await browser.close();
}

waitUntil: 'networkidle2' asks navigation to wait for network activity to become idle according to Puppeteer’s lifecycle condition. It may not suit sites with persistent requests or content that appears later, so use a more appropriate navigation condition or an explicit wait when needed. For a fixed real-time pause after navigation, add await new Promise(resolve => setTimeout(resolve, 5000)); before page.screenshot().

Viewport capture versus full-page capture

The viewport set with page.setViewport() controls the page’s visible layout area. fullPage: true asks Puppeteer to capture the full page rather than only the current viewport. A full-page screenshot can be much taller than a viewport shot; if the target page lazy-loads images as the reader scrolls, confirm those assets have loaded before capturing.

Screenshot return values

With a path, Puppeteer writes the image to disk. Without a path, page.screenshot() returns image data as a Uint8Array; with the screenshot option encoding: 'base64', it returns a base64 string. The API reference also notes that page creation or closing waits for an in-progress screenshot in the same BrowserContext, which helps avoid racing those operations against capture.

Use the Chrome DevTools Protocol directly

The Chrome DevTools Protocol (CDP) gives direct access to browser commands, including Page.captureScreenshot. Choose it when your service already speaks CDP or needs protocol-level control over capture parameters. It has less of Puppeteer’s convenience layer, so you are responsible for connecting to a target and issuing the appropriate protocol commands.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Capture Card, USB Video Capture Card Device, Audio Video Converter Grabber for RCA to USB-Convert VHS Mini DV VCR Hi8 DVD to Digital, for PC TV Tape Player Camcorder, MAC Windows Vista Compatible
  • AV TO USB Converter: Capture videos and audios from VHS, VCR, Hi8, DV tapes to a PC, with the help of our USB Video Converter. Save room while digitizing your favorite old memories
  • Quality Capture Card: Our USB Video Capture Card converting anolog RCA composite input into HD 720P USB output and capturing audio without any sound card. Advanced signal processing technology provides you with great precision, colors, resolutions, and details.
  • Plug and Play: Automatically install the driver once you hook up this RCA to USB Converter to a PC. No external power is needed. User-friendly and easy to operate
  • Wide Compatibility: The Video Capture Card can work with video devices with RCA connector or S-Video connector, such as VHS, VCR, Hi8, camcorder, compatible with Windows and Mac OS. Support video formats like NTSC, PAL, and support brightness, contrast, hue, and saturation control
  • Note: The Video Converter is used with acquisition software. We recommend OBS Studio or PotPlayer for Windows, and QuickTime Player for Mac. They can be downloaded for free online. Please operate according to the steps in User Manual or contact us if you have any questions
  1. Start Chrome with a remote debugging port, for example: chrome --headless=new --remote-debugging-port=0 https://example.com.
  2. Read Chrome’s output for the WebSocket endpoint. It has a form similar to ws://127.0.0.1:PORT/devtools/browser/...; use the actual endpoint printed by your Chrome process.
  3. Connect your CDP client to the endpoint and the page target, enable the Page domain, then call Page.captureScreenshot.
  4. Decode the returned image data if your client needs a file, and write it with the intended image format and path.

The protocol reference defines the command, but the exact connection and target-selection code depends on the CDP client you use. If your application does not already need protocol-level access, Puppeteer is usually the more direct JavaScript interface.

Choose Selenium when your test suite already uses WebDriver

Selenium-WebDriver is another route to a headless Chrome screenshot. It fits best when the surrounding browser tests and automation are already built on WebDriver; for a JavaScript-first screenshot script, Puppeteer offers a more focused API.

In Selenium, add Chrome’s --headless argument to the Chrome options, create a WebDriver instance, navigate to the URL, capture a screenshot using the driver’s screenshot API, and quit the driver. The exact setup code depends on the Selenium language binding and driver version, so follow the installation and API instructions for the binding already used by your project. Keep navigation and wait conditions explicit: a screenshot taken immediately after navigation may capture a loading state.

Compare the four Chrome screenshot routes

Route Abstraction and fit Timing and output Debugging access
Chrome CLI Fastest way to demonstrate a one-off capture; no application code required. --screenshot writes PNG; --window-size, --timeout, and --virtual-time-budget provide basic controls. Can be launched with remote debugging enabled.
Puppeteer Approachable JavaScript API for browser automation. page.screenshot() supports options such as a file path, full-page capture, and base64 encoding; navigation and waits are scriptable. Uses Chrome automation and can be paired with DevTools inspection.
CDP Lowest-level choice; suitable for software already integrated with the protocol. Page.captureScreenshot exposes protocol-level capture control. Connect to the WebSocket endpoint emitted by Chrome.
Selenium Natural fit for an existing WebDriver test suite. Screenshot and wait behavior are handled through the selected binding and driver APIs. Uses the existing WebDriver workflow.

Inspect a headless page when the image is wrong

Headless Chrome has no visible window to inspect by eye while it runs. Remote debugging gives you a way to attach Chrome DevTools to the running browser and diagnose navigation, timing, viewport, or rendering problems.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Video Capture Card, 4K USB3.0 HDMI to USB C, 1080P60FPS HDMI Capture Card for Streaming, Gaming, Video Recording Compatible with Switch, Xbox, PS4/5, OBS,iPad Mac OS Windows,Camera, Zoom(Silver)
  • 【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.
  1. Launch Chrome with --remote-debugging-port=0 along with the relevant Headless and navigation arguments.
  2. Copy the ws://127.0.0.1:PORT/devtools/browser/... endpoint printed by Chrome.
  3. Open another Chrome instance and visit chrome://inspect.
  4. Configure the host and port shown in the endpoint, then inspect the available target.

This uses the DevTools inspection workflow available for Chrome; it does not make the original headless window visible.

Troubleshoot common screenshot problems

  • The command says Chrome cannot be found. The executable may not be on your shell’s PATH or may have a different platform-specific name. Use the installed executable’s full path or its correct command name.
  • No screenshot appears where expected. The CLI writes screenshot.png in the current working directory, not necessarily the directory containing Chrome. Check pwd or its platform equivalent before running the command.
  • The screenshot is clipped or laid out unexpectedly. Set --window-size=WIDTH,HEIGHT in the CLI or page.setViewport() in Puppeteer. Viewport dimensions affect responsive layout; they are not a guarantee of device emulation.
  • The image shows a spinner, skeleton, or partial page. Add a deliberate wait. Use --timeout for real elapsed time, --virtual-time-budget for timer-driven content, or Puppeteer navigation and selector waits suited to the page.
  • Some images are missing in a full-page shot. Lazy-loaded assets may not be requested until their area approaches the viewport. Scroll through the page or otherwise trigger loading and wait for the images before the capture.
  • The page never reaches Puppeteer’s network-idle condition. Pages with long-lived network connections can prevent that condition from being useful. Use a different waitUntil condition and wait for a specific page element or state instead.
  • You need to see what the headless browser rendered. Enable --remote-debugging-port=0, then connect through chrome://inspect as described above.
  • A legacy Headless example behaves differently. Since Chrome 132.0.6793.0, the old Headless implementation is available as a separate chrome-headless-shell binary. Prefer unified Headless for new work; use the shell only when a legacy workflow specifically requires it.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your goal is to get screenshots through an API rather than manage a local Chrome process, ScreenshotNeo takes a URL in one GET request and returns a PNG, JPEG, WebP, or PDF. Its API accepts the same parameter names used by other screenshot APIs, which can make switching simpler. The code below follows the ScreenshotNeo API documentation.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
  • Before capture, it accepts the cookie or consent banner like a visitor and removes 60+ known consent platforms, newsletter popups, and chat widgets; each step can be turned off.
  • Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing. Response headers report the page verdict and billing status.
  • An MCP server gives AI agents tools named take_screenshot, get_page_info, and capture_pdf.
  • The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Every feature is available on every plan.

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

Sources and version notes

Chrome’s Headless behavior and examples are documented by Chrome for Developers. The unified-mode migration note is also described in the Chrome Headless Shell documentation. Puppeteer’s automation overview and screenshot behavior are documented in its official documentation and Page.screenshot API reference. The CDP screenshot command is described in the DevTools Protocol Page reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
VIXLW 4K HDMI Video Capture Card, Cam Link Card, HDMI to USB 2.0 Game Audio Adapter, Record Capture Device for Streaming, Teaching, Gaming, Live Broadcasting, Video Conference [Windows]
  • 【4K VIDEO CAPTURE CARD】Made with upgraded chip, captures 4K@60Hz video input at full speed, no lag, no delay, capture card also supports 1920×1080@30Hz highest image quality output, capture video to USB through HDMI, you can Directly save to computer and mobile phone; suitable for high-definition video live broadcast, video capture, online conference, video streaming, video course; equipped with high-definition USB cable.
  • 【HDMI real-time screen sharing】The HDMI interface is made of nano-metal material, so that the video can reach ultra-low latency. The audio and video capture card can capture video and audio at the same time, and store the video signal into the computer and smartphone, and support OBS post-video. Editor, this is an excellent solution for online meetings and live broadcasts, economical and fast, 4K HDMI Capture Card is widely used in live broadcast, conference, photography, medicine, daily office.
  • 【Plug and Play】4K video capture card has built-in drivers, no need to install complicated programs, no external power supply, plug and play, very convenient, just plug into your computer, you can use it, the shell is made of aluminum alloy seamlessly , small size, very convenient to carry, suitable for capturing interesting details in life, can be used for indoor and outdoor live broadcast, and the color of the picture is more delicate.
  • 【Wide Compatibility】The video capture card adopts advanced chips, intelligent identification equipment, and is widely compatible with electronic equipment, which can easily capture wonderful moments and comes with a USB cable. It supports third-party video capture software such as OBS, Win, MacOs, Android, etc. It can also perform video capture and online live broadcast at the same time, store and share videos at the same time, and easily realize video splicing, which is very convenient.
  • 【24 hours local technical support】We have a professional technical team for more than ten years, serving you 24 hours a day. You are welcome to contact us if you have any questions.

Frequently Asked Questions

Can I use Chrome Headless without Puppeteer?

Yes. Chrome’s command-line --headless and --screenshot options can capture a URL directly.

Does --window-size emulate a phone?

No. It sets viewport width and height, but does not by itself emulate a specific device or device pixel ratio.

Which option should I choose for a new JavaScript screenshot script?

Puppeteer is the high-level JavaScript option; CDP is the lower-level alternative when direct protocol control is needed.

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.

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

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.

Read next

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.