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 problemsIf chrome --headless --dump-dom URL appears to produce nothing, first verify that you are running the intended binary, that the URL is the final argument, and that you are looking at standard output rather than only standard error. The --dump-dom flag prints Chrome’s serialized, script-processed DOM to stdout; it does not automatically create a file. Capture stdout and stderr separately, check the exit status, then investigate page timing, browser version, and the actual executable.
What --dump-dom is supposed to do
Chrome’s command-line reference says: “The --dump-dom flag prints the serialized DOM of the target page to stdout.” (Chrome Headless command-line reference). In other words, output normally appears in your terminal or wherever your shell redirects stdout. Chrome does not save a file unless you ask the shell to do so.
The result is also different from downloading the server response. Chrome parses the HTML, runs page scripts, applies DOM changes, and then serializes the resulting DOM. A page whose visible content is inserted by JavaScript can therefore produce output that differs substantially from its initial response.
Start with a minimal, known-good invocation
Reduce the problem to one executable, one public URL, and the two relevant flags. Replace the executable name with the path used on your system.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →#1 Best Overall
google-chrome --headless --dump-dom https://example.com
On other installations the command may be chrome, chromium, chromium-browser, or an absolute path. Keep the URL last and quote URLs containing shell metacharacters.
"/path/to/chrome" --headless --dump-dom "https://example.com"
Use a simple, publicly reachable page first. A private application, login flow, certificate problem, bot challenge, or JavaScript-heavy site adds independent variables and can make an empty result difficult to interpret.
Separate stdout, stderr, and the exit status
Because the DOM is written to stdout, a wrapper, IDE, container entrypoint, or shell redirection can hide it or mix it with diagnostics. Save each stream independently and inspect the process result.
Linux and macOS (POSIX shells)
google-chrome --headless --dump-dom "https://example.com"
> dom.html
2> chrome-errors.log
status=$?
printf 'exit status: %sn' "$status"
wc -c dom.html
sed -n '1,20p' chrome-errors.log
A nonzero status means the process reported an error, but a zero status does not prove that the page contained the text you expected. Check the size and contents of dom.html directly.
Windows PowerShell
& "$env:ProgramFilesGoogleChromeApplicationchrome.exe" `
--headless --dump-dom "https://example.com" `
1> dom.html `
2> chrome-errors.log
$LASTEXITCODE
Get-Item dom.html
Get-Content chrome-errors.log
Do not redirect both streams to the same destination while diagnosing; Chrome diagnostics can obscure whether any DOM bytes were emitted.
Verify the executable and version you actually invoke
Multiple Chrome and Chromium copies are common on developer machines and containers. Resolve the command before changing flags.
Rank #2
command -v google-chrome
command -v chromium
which -a google-chrome chromium 2>/dev/null
google-chrome --version
On Windows, use:
Get-Command chrome, chromium -All
& "C:Program FilesGoogleChromeApplicationchrome.exe" --version
Compare the path and version with the browser you intended to automate. Chromium’s Headless documentation records an important version boundary: precompiled standalone headless-shell binaries were available through Chrome for Testing from M118, while as of M132 old Headless shell functionality is no longer part of the Chrome binary. The --headless=old switch has no effect in that newer Chrome, and users who specifically need old Headless behavior are directed to chrome-headless-shell (Chromium Headless Chromium README).
This migration note does not establish that every empty dump is a version problem. It does mean that a troubleshooting report must identify the executable and version rather than merely saying “Chrome.”
Determine whether timing explains the missing content
Chrome captures after the page loads by default when neither --timeout nor --virtual-time-budget is supplied. For pages that continue loading or populate the DOM shortly afterward, Chrome documents --timeout=<milliseconds> as the maximum wait before capture, including while the page is still loading (command-line reference).
google-chrome --headless --dump-dom --timeout=10000
"https://example.com/app" > dom.html
Choose a bounded value appropriate to the page; increasing it indefinitely is not a substitute for understanding the application. A timeout cannot perform a required click, complete an authentication flow, solve a challenge, or satisfy an application-specific readiness condition. If the target needs those actions, a browser automation workflow with explicit waits may be more suitable.
Compare initial HTML with the serialized DOM
Ask whether the text you expect exists in the server response at all. If it is absent from the initial HTML but appears only after scripts run, a fetch of the URL and a DOM dump are expected to differ. Conversely, if the serialized output is genuinely empty, inspect errors, redirects, blocked resources, and the page’s final URL rather than assuming that JavaScript timing is the sole cause.
Use virtual time only for suitable pages
Chrome’s Headless documentation discusses virtual-time controls for deterministic script execution (New Headless in Chrome). Virtual time is useful for particular test scenarios; it is not a universal replacement for waiting on network, user interaction, or login state.
Rank #3
Check URL, navigation, and access conditions
- URL position: Keep the target URL after all options. A misplaced URL can be interpreted as an argument rather than the navigation target.
- Quoting: Quote URLs containing
&,?, parentheses, or spaces so the shell does not rewrite them. - Scheme and certificate: Test the exact
https://orhttp://address in a normal browser and inspect redirects and certificate errors. - Authentication: A command-line launch has no existing cookies or login session unless you explicitly provide a profile or credentials. A protected route may legitimately return a login page or an access-denied response.
- Bot checks: A challenge page may not contain the application DOM you expected. Treat that as a different page state, not proof that
--dump-domfailed. - Local addresses: In containers,
localhostrefers to the container itself. Confirm that the service is reachable from the same environment as Chrome.
Use the right Headless environment
Distinguish Chrome’s integrated current Headless mode from an intentionally installed chrome-headless-shell. Record which executable is used, its version, and whether your workflow depends on old Headless-specific behavior. Do not add Xvfb merely because output is empty: Chromium’s guidance mentions Xvfb and --ozone-platform=headless in the context of running tests, not as a blanket requirement for ordinary Headless CLI use (Running tests locally).
If a test harness launches a different binary than your interactive shell, print the resolved path and version from inside that harness. Container images can also retain an older browser while the host has a newer one.
Common symptoms and targeted fixes
| Symptom | Likely area to inspect | Action |
|---|---|---|
| Terminal shows nothing, but exit status is zero | stdout handling or an unexpectedly small DOM | Redirect stdout to dom.html, stderr separately, then inspect file size and contents. |
| Only warnings appear | Streams merged or stdout discarded | Use separate > and 2> redirections and check the exit code. |
| Static shell is present, app content is absent | Script timing or blocked navigation | Compare initial HTML, try a bounded --timeout, and inspect the final page state. |
| Works on one machine but not another | Different executable, version, OS, or container network | Report absolute binary path, --version, platform, and network context. |
| Legacy Headless flags no longer change behavior | Chrome M132 or newer | Verify whether you need current integrated Headless or the separately supplied chrome-headless-shell. |
| Output contains a challenge or login page | Access policy, cookies, or bot protection | Authenticate through an approved automation design or diagnose the returned page; do not treat it as the target application’s DOM. |
Build a reproducible diagnostic report
An empty run cannot be assigned one universal cause without its invocation details. Include:
- the exact command, with secrets removed;
- the absolute executable path and version output;
- operating system, container image, and architecture;
- the URL, including whether it redirects or requires authentication;
- separate stdout and stderr captures;
- the numeric exit status;
- whether a known public URL produces serialized HTML;
- the timeout or virtual-time options used.
This information separates a shell redirection mistake from a navigation failure, a script-timing issue, and a browser-version mismatch.
Recommended Free Tools
Or skip the browser setup
If your goal is a reliable website image or PDF rather than debugging Chrome’s DOM stream, ScreenshotNeo provides a single HTTP request and an MCP server for AI agents. Before capture it accepts cookie or consent banners and removes 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 response headers identify the page verdict and billing result.
Use the documented API endpoint (ScreenshotNeo documentation):
cURL
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
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)
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}`);
ScreenshotNeo also supports full-page and element captures, device presets or custom viewports, retina scale, dark mode, PDFs, HTML/CSS rendering, custom JavaScript and CSS, clicks, waits, request blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, TTL caching, signed links, asynchronous webhooks, bulk requests for up to 100 URLs, usage reporting, and an OpenAPI specification. Its MCP tools are take_screenshot, get_page_info, and capture_pdf.
Rank #4
Every feature is included on every plan: 1,000 screenshots per month free with no card; paid plans start at $5 for 3,000 shots, with yearly billing providing two months free. Create a free ScreenshotNeo account to try the 1,000 monthly screenshots without a card.
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 matchWindows 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 reinstallFAQ
Does --dump-dom write a file automatically?
No. It writes serialized DOM bytes to stdout. Use shell redirection such as > dom.html when you need a file.
Is an empty DOM dump proof that the URL returned an empty response?
No. Output handling, navigation, timing, access controls, and the selected browser binary can all produce different symptoms. Capture both streams and the exit status before deciding.
Should I always install Xvfb?
No. Chromium documents Xvfb and --ozone-platform=headless for test-running contexts. Ordinary Headless CLI use does not establish a blanket Xvfb requirement.
Frequently Asked Questions
Does --dump-dom write a file automatically?
No. It writes serialized DOM bytes to stdout. Use shell redirection such as > dom.html when you need a file.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Is an empty DOM dump proof that the URL returned an empty response?
No. Output handling, navigation, timing, access controls, and the selected browser binary can all produce different symptoms. Capture both streams and the exit status before deciding.
Should I always install Xvfb?
No. Chromium documents Xvfb and --ozone-platform=headless for test-running contexts. Ordinary Headless CLI use does not establish a blanket Xvfb requirement.
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.




