chrome headless dump dom flag prints nothing to stdout

Viewed 142

Executing headless chrome with the flag --dump-dom or --dump-html yields nothing on stdout. Does anyone know why?

Commands I have tried, with no output:

"c:\Program Files\Google\Chrome\Application\chrome.exe" --headless --dump-dom --disable-gpu https://www.chromestatus.com/
"c:\Program Files\Google\Chrome\Application\chrome.exe" --headless --dump-html --disable-gpu https://www.chromestatus.com/
"c:\Program Files\Google\Chrome\Application\chrome.exe" --headless --dump-html https://www.chromestatus.com/
"c:\Program Files\Google\Chrome\Application\chrome.exe" --headless --dump-dom https://www.chromestatus.com/
"c:\Program Files\Google\Chrome\Application\chrome.exe" --headless --dump-dom --incognito https://www.chromestatus.com/

Removing the --headless option will open the chrome window, no problem.

"c:\Program Files\Google\Chrome\Application\chrome.exe" --dump-html https://www.chromestatus.com/

I can screenshot with --headless chrome no problem.

"c:\Program Files\Google\Chrome\Application\chrome.exe" --headless --screenshot=D:\test.png --disable-gpu --window-size=320,568 https://www.chromestatus.com --user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1"

screenshot

Python script showing process is successfully run.

In [1]: import subprocess

In [2]: cp = subprocess.run( '"c:\Program Files\Google\Chrome\Application\chrome.exe" --headless --dump-dom --disable-gpu https://www.chromestatus.com/', shell=True)

In [3]: cp.stderr

In [4]: cp.returncode
Out[4]: 0

In [5]: cp.args
Out[5]: '"c:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" --headless --dump-dom --disable-gpu https://www.chromestatus.com/'

In [6]: cp.stderr

In [7]: cp = subprocess.run( '"c:\Program Files\Google\Chrome\Application\chrome.exe" https://www.chromestatus.com/', shell=True)

Information

  • chrome version: 99.0.4844.51 (Official Build) (64-bit)
  • Windows version 20H2 (10942.1415)
  • Also I have multiple google chrome sync accounts. I dunno if the will interfere.

multiple chrome accounts

Reference:

0 Answers
Related