google-chrome --headless --screenshot在Centos 7上崩溃了"无法获取下载目录"的消息

Ale*_*lex 5 google-chrome headless google-chrome-headless

我正试图通过命令行使用Google Chrome 59 (谷歌浏览器59.0.3071.86)的新功能在Centos 7盒中获取屏幕截图,我收到一条错误消息,说它无法获取下载目录.我试图在我的主文件夹中创建目录但没有成功!有什么建议?

    [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
Run Code Online (Sandbox Code Playgroud)

这是我的文件夹结构:

    [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 ~]#
Run Code Online (Sandbox Code Playgroud)

kar*_*los 2

我在这里找到了答案: https://bugs.chromium.org/p/chromium/issues/detail ?id=695212

修复方法是安装 google 字体包:

$ sudo yum install gnu-free-sans-fonts
Run Code Online (Sandbox Code Playgroud)

那么这应该有效:

$ google-chrome --headless --disable-gpu --enable-logging -v=10  --screenshot=out.png http://www.chromestatus.com
Run Code Online (Sandbox Code Playgroud)