`dump-dom` command switch not working

1,490 views
Skip to first unread message

daniel.sok...@gmail.com

unread,
Jul 11, 2016, 12:33:37 PM7/11/16
to headless-dev
Hello All,

Need a sanity check, just compiled `headless_shell` and attempting to leverage the `--dump-dom` without success, am I missing something obvious, the process appears to just sit there and needs 'CTR + C'.

```
root@lh1:~/chromium-src/src/out/headless_shell# ^C
root@lh1:~/chromium-src/src/out/headless_shell# ./headless_shell --dump-dom --no-sandbox  http://danols.com
[0711/085204:INFO:fake_audio_manager.cc(23)] FakeAudioManager
^[[28~^C
root@lh1:~/chromium-src/src/out/headless_shell# ./headless_shell --dump-dom --no-sandbox google.com
[0711/085348:INFO:fake_audio_manager.cc(23)] FakeAudioManager
[0711/085348:ERROR:headless_shell.cc(68)] Navigation failed
[0711/085348:INFO:fake_audio_manager.cc(27)] ~FakeAudioManager
root@lh1:~/chromium-src/src/out/headless_shell# ./headless_shell --dump-dom --no-sandbox https://google.com
[0711/085356:INFO:fake_audio_manager.cc(23)] FakeAudioManager
^C
root@lh1:~/chromium-src/src/out/headless_shell# ./headless_shell --dump-dom --disable-java --disable-popup-blocking --disable-sync --disable-web-security --disable-first-run-ui --ignore-certificate-errors --no-default-browser-check --nofirst-run --non-secure --disable-gpu --no-sandbox --temp-profile --user-data-dir=".\headless-chrome-tries" --remote-debugging-port=1000  --remote-debugging-address=0.0.0.0 http://danols.com
[0711/085435:INFO:fake_audio_manager.cc(23)] FakeAudioManager
root@lh1:~/chromium-src/src/out/headless_shell#
^C
```

Sebastian Cato

unread,
Jul 11, 2016, 4:54:29 PM7/11/16
to headless-dev, daniel.sok...@gmail.com
Hello,

Works for me, FWIW. What are your gn args? How did you build?

$ uname -a
Linux genesis 4.5.6-200.fc23.x86_64 #1 SMP Wed Jun 1 21:28:20 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ git rev
-parse HEAD
2ae1aad0785caca16bddfe5e960e67b1443ddc90
$
./headless_shell --dump-dom 'https://public-firing-range.appspot.com/address/location.hash/documentwriteln#foobar' 2>/dev/null

   
<script>
     
var payload = window.location.hash.substr(1);document.writeln(payload);

   
</script>foobar

 




Interesting user choice, especially with --no-sandbox ;)

daniel.sok...@gmail.com

unread,
Jul 12, 2016, 10:27:37 PM7/12/16
to headless-dev, daniel.sok...@gmail.com
Hey Sebastian, thank you for the sanity check, I build the headless_chrome as per https://chromium.googlesource.com/chromium/src/+/master/headless/README.md except instead of `out/Debug` I did `out/headless_chromium` don't think that would be the issue?

Eric Seckler

unread,
Jul 13, 2016, 4:13:42 AM7/13/16
to daniel.sok...@gmail.com, headless-dev
Hi Daniel,

Using a different output directory shouldn't be an issue. I just tried a headless_shell built from the current head and --dump-dom works fine for me as well. If yours hangs for a long time, that sounds like the the page doesn't become ready for some reason (maybe a network issue?). 
Does headless_shell shut down eventually if you use it without --dump-dom, or does it hang then as well?

To debug this further, you could try taking a trace:
$ headless_shell --trace-startup=* --trace-startup-duration=10 http://www.independent.co.uk

You may need to adjust the duration. Please file a bug at crbug.com if you want to share the traces with us (label Proj-Headless, cc me).

Good luck!
Eric

--
You received this message because you are subscribed to the Google Groups "headless-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to headless-dev...@chromium.org.
To post to this group, send email to headle...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/headless-dev/146a52c2-13dc-49c9-adcc-addb7546b1ab%40chromium.org.

daniel.sok...@gmail.com

unread,
Jul 13, 2016, 11:07:39 PM7/13/16
to headless-dev, daniel.sok...@gmail.com
Hi Eric, it never completes, just sits there. To try to minimize any discretenesses between your test and mine I run headless_chrome from a normal user account and got following error output. I will try the tracing command next. 

```
root@lh1:~/chromium-src/src/out/headless_shell# su danielsokolowski
danielsokolowski@lh1:/root/chromium-src/src/out/headless_shell$ ./headless_shell --dump-dom 'https://public-firing-range.appspot.com/address/location.hash/documentwriteln#foobar' 2>/dev/null
Aborted
danielsokolowski@lh1:/root/chromium-src/src/out/headless_shell$ ./headless_shell --dump-dom https://public-firing-range.appspot.com/address/location.hash/documentwriteln#foobar
[0711/180501:FATAL:v8_initializer.cc(261)] Couldn't mmap v8 natives data file, status code is 1
#0 0x000005540e8e (/root/chromium-src/src/out/headless_shell/headless_shell+0x5540e8d)
#1 0x000005582a4f (/root/chromium-src/src/out/headless_shell/headless_shell+0x5582a4e)
#2 0x00000780ce50 (/root/chromium-src/src/out/headless_shell/headless_shell+0x780ce4f)
#3 0x0000051b9195 (/root/chromium-src/src/out/headless_shell/headless_shell+0x51b9194)
#4 0x0000051b63c9 (/root/chromium-src/src/out/headless_shell/headless_shell+0x51b63c8)
#5 0x000005441f36 (/root/chromium-src/src/out/headless_shell/headless_shell+0x5441f35)
#6 0x000005442241 (/root/chromium-src/src/out/headless_shell/headless_shell+0x5442240)
#7 0x00000042a0b3 (/root/chromium-src/src/out/headless_shell/headless_shell+0x42a0b2)
#8 0x7fe3fac4eb45 __libc_start_main
#9 0x000000429845 (/root/chromium-src/src/out/headless_shell/headless_shell+0x429844)

Aborted
danielsokolowski@lh1:/root/chromium-src/src/out/headless_shell$ cp headless
headless-chrome-tries/ headless_lib.pak       headless_shell
danielsokolowski@lh1:/root/chromium-src/src/out/headless_shell$ cp headless_shell ~
danielsokolowski@lh1:/root/chromium-src/src/out/headless_shell$ cd ~
danielsokolowski@lh1:~$ dir
headless_shell
danielsokolowski@lh1:~$ ls
headless_shell
[0711/180553:FATAL:v8_initializer.cc(261)] Couldn't mmap v8 natives data file, status code is 1
#0 0x000005540e8e base::debug::StackTrace::StackTrace()
#1 0x000005582a4f logging::LogMessage::~LogMessage()
#2 0x00000780ce50 gin::V8Initializer::LoadV8Natives()
#3 0x0000051b9195 content::ContentMainRunnerImpl::Initialize()
#4 0x0000051b63c9 content::ContentMain()
#5 0x000005441f36 headless::(anonymous namespace)::RunContentMain()
#6 0x000005442241 headless::HeadlessBrowserMain()
#7 0x00000042a0b3 main
#8 0x7f9dd98ccb45 __libc_start_main
#9 0x000000429845 <unknown>

Aborted
danielsokolowski@lh1:~$
```

daniel.sok...@gmail.com

unread,
Jul 13, 2016, 11:10:09 PM7/13/16
to headless-dev, daniel.sok...@gmail.com
```
root@lh1:~/chromium-src/src# uname -a
Linux lh1 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2+deb8u3 (2016-07-02) x86_64 GNU/Linux
root@lh1:~/chromium-src/src# git rev-parse HEAD
3ebd491419a62d22093a68e7ae3820157a32ecb5
```

daniel.sok...@gmail.com

unread,
Jul 13, 2016, 11:38:35 PM7/13/16
to headless-dev, daniel.sok...@gmail.com
What's the output I'm supposed to be seeing from the trace? It's just stis there on my end, waited a few minutes:

```
root@lh1:~/chromium-src/src/out/headless_shell# ./headless_shell --no-sandbox --temp-profile --user-data-dir=".\headless-chrome-tries"  --trace-startup=* --trace-startup-duration=10 http://www.independent.co.uk
[0711/183958:INFO:fake_audio_manager.cc(23)] FakeAudioManager



^C

```

Eric Seckler

unread,
Jul 14, 2016, 3:27:51 AM7/14/16
to daniel.sok...@gmail.com, headless-dev
That's okay, it creates a trace output file (trace.json). You can load in into (a non-headless) chrome by visiting chrome://tracing. See info here.

I just realized that you didn't change the "out" folder but the release/debug folder. That could actually make a difference. Can you try building into out/Debug or out/Release?

daniel.sok...@gmail.com

unread,
Jul 16, 2016, 9:38:26 AM7/16/16
to headless-dev, daniel.sok...@gmail.com
Ok, through trail and error I was able to get it to work, changing the output folder to `out/Debug` had no effect but re-compiling using a normal account did work!. I believe a note that compiling as `root` is not supported and produce a non-working binary in the README might be called for? I could submit a patch.

Thank you Eric for help, much appreciated!

daniel.sok...@gmail.com

unread,
Jul 16, 2016, 9:53:05 AM7/16/16
to headless-dev, daniel.sok...@gmail.com
For completeness here is the console output:

```
root@lh1:~/chromium-src/src/out/Debug# /home/danielsokolowski/chromium-src/src/out/Debug/headless_shell --dump-dom --no-sandbox  http://danols.com
[0716/095054:INFO:fake_audio_manager.cc(23)] FakeAudioManager
A Parser-blocking, cross-origin script, http://www.google-analytics.com/ga.js, is invoked via document.write. This may be blocked by the browser if the device has poor network connectivity.
[0716/095055:INFO:CONSOLE(20)] "A Parser-blocking, cross-origin script, http://www.google-analytics.com/ga.js, is invoked via document.write. This may be blocked by the browser if the device has poor network connectivity.", source: http://danols.com/ (20)
A Parser-blocking, cross-origin script, http://www.google-analytics.com/ga.js, is invoked via document.write. This may be blocked by the browser if the device has poor network connectivity.
[0716/095055:INFO:CONSOLE(20)] "A Parser-blocking, cross-origin script, http://www.google-analytics.com/ga.js, is invoked via document.write. This may be blocked by the browser if the device has poor network connectivity.", source: http://danols.com/ (20)

        ...


[0716/095056:INFO:fake_audio_manager.cc(27)] ~FakeAudioManager
root@lh1:~/chromium-src/src/out/Debug# /root/chromium-src/src/out/Debug/headless_shell --dump-dom --no-sandbox  http://danols.com~
[0716/095107:INFO:fake_audio_manager.cc(23)] FakeAudioManager
[0716/095107:ERROR:headless_shell.cc(68)] Navigation failed
[0716/095107:INFO:fake_audio_manager.cc(27)] ~FakeAudioManager
root@lh1:~/chromium-src/src/out/Debug# /root/chromium-src/src/out/Debug/headless_shell --dump-dom --no-sandbox  http://danols.com
[0716/095111:INFO:fake_audio_manager.cc(23)] FakeAudioManager
^C

```
Reply all
Reply to author
Forward
0 new messages