Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

google-chrome --headless --screenshot is crashing with message "Could not get download directory" on Centos 7

I'm attempting to get a screenshot via command line using the new features of Google Chrome 59 (Google Chrome 59.0.3071.86) in a Centos 7 box and I'm getting an error saying it could not get the download directory. I attempted to create the directory in my home folder but no success! Any suggestions?

    [root@vm_1 ~]# google-chrome-stable --headless --disable-gpu --enable-logging -v=5 --screenshot=out.png http://www.google.com
    [0613/154943.103775:VERBOSE1:zygote_main_linux.cc(626)] ZygoteMain: initializing 0 fork delegates
    [0613/154943.104006:INFO:cpu_info.cc(50)] Available number of cores: 1
    [0613/154943.108816:VERBOSE1:audio_manager_pulse.cc(273)] Failed to connect to the context.  Error: Connection refused
    [0613/154943.108868:WARNING:audio_manager.cc(293)] Multiple instances of AudioManager detected
    [0613/154943.108875:WARNING:audio_manager.cc(254)] Multiple instances of AudioManager detected
    [0613/154943.109345:VERBOSE1:webrtc_internals.cc(106)] Could not get the download directory.
    Trace/breakpoint trap
    [root@vm_1 ~]# google-chrome-stable --version
    [root@vm_1 ~]# Google Chrome 59.0.3071.86

Here is my folder structure:

    [root@vm_1 ~]# ls -la
    total 56
    dr-xr-x---. 12 root root  4096 Jun 13 15:23 .
    dr-xr-xr-x. 17 root root  4096 Jun 13 13:42 ..
    -rw-------.  1 root root  1116 Dec 24  2015 anaconda-ks.cfg
    drwx------.  3 root root    16 Jan 22 10:10 .ansible
    -rw-------.  1 root root 18800 Jun 13 14:59 .bash_history
    -rw-r--r--.  1 root root    18 Dec 28  2013 .bash_logout
    -rw-r--r--.  1 root root   176 Dec 28  2013 .bash_profile
    -rw-r--r--.  1 root root   176 Dec 28  2013 .bashrc
    drwx------.  3 root root    16 Oct 24  2016 .cache
    drwx------.  3 root root    26 Jun 13  2017 .config
    -rw-r--r--.  1 root root   100 Dec 28  2013 .cshrc
    drwxr-xr-x.  2 root root     6 Jun 13  2017 download
    drwxr-xr-x.  2 root root     6 Jun 13  2017 Download
    drwxr-xr-x.  2 root root     6 Jun 13  2017 downloads
    drwxr-xr-x.  2 root root     6 Jun 13  2017 Downloads
    drwxr-xr-x.  3 root root    18 Jun 13  2017 .local
    drwxr-----.  3 root root    18 Dec 24  2015 .pki
    drwx------.  2 root root    28 Jan 22 10:09 .ssh
    -rw-r--r--.  1 root root   129 Dec 28  2013 .tcshrc
    -rw-r--r--   1 root root   228 Jun 13 15:23 test.py
    [root@vm_1 ~]#
like image 282
Alex Avatar asked Oct 30 '22 06:10

Alex


1 Answers

I found an answer to this here: https://bugs.chromium.org/p/chromium/issues/detail?id=695212

The fix is to install the google font package:

$ sudo yum install gnu-free-sans-fonts

Then this should work:

$ google-chrome --headless --disable-gpu --enable-logging -v=10  --screenshot=out.png http://www.chromestatus.com
like image 81
karlos Avatar answered Nov 13 '22 22:11

karlos