Reputation:
Here's exactly what I did:
I ran the command:
chrome.exe --headless --dump-dom "https://www.example.com/"
According to the manual, this is supposed to open that URL headlessly and dump the DOM as text after JavaScript has been executed, to the stdout, meaning the cmd.exe
in this case.
Problem: Nothing happens. Literally no output at all. The only thing that I can tell that happens (and that was just out of pure coincidence) is that a file called chrome_debug.txt
is created in the same directory, with this contents:
[0712/065333.417:ERROR:browser_process_sub_thread.cc(203)] Waited 5 ms for network service
If I instead run the command:
chrome.exe "https://www.example.com/"
It opens the browser and goes to that URL (as expected). So it's not something fundamentally wrong with my Internet connection or computer.
What am I doing wrong?
Upvotes: 5
Views: 5691
Reputation: 63
You might want to try to enable logging by adding the --enable-logging
flag to the command line.
Also, although according to this bug report this is no longer necessary, it may be wise to add the --disable-gpu
flag to prevent GPU errors from showing in the stdout.
The final command line should look like this:
chrome.exe --headless --enable-logging --disable-gpu --dump-dom "https://www.example.com/""
which returns the DOM of www.example.com/ on chromium 76.0.3809.87 succesfully.
Upvotes: 4