2016-02-04 97 views
1

我試圖在Ubuntu上使用以下命令來運行無頭Chrome。在Ubuntu上運行無頭鍍鉻

sudo -u test xvfb-run --server-args='-screen 0, 1024x768x16' google-chrome -start-maximized --disable-fre --enable-benchmarking --metrics-recording-only --remote-debugging-port=1234 > /dev/null &

一旦這樣,ps -ef | grep Chrome我得到

test 17671 17670 0 15:49 pts/0 00:00:00 /bin/sh /usr/bin/xvfb-run --server-args=-screen 0, 1024x768x16 google-chrome -start-maximized --disable-fre --enable-benchmarking --metrics-recording-only --remote-debugging-port=1234 
test 17691 17671 0 15:49 pts/0 00:00:00 /usr/bin/google-chrome -start-maximized --disable-fre --enable-benchmarking --metrics-recording-only --remote-debugging-port=1234 
test 17694 17691 0 15:49 pts/0 00:00:00 /usr/bin/google-chrome -start-maximized --disable-fre --enable-benchmarking --metrics-recording-only --remote-debugging-port=1234 
test 17696  1 0 15:49 pts/0 00:00:00 /opt/google/chrome/chrome --type=zygote 

但我不斷收到錯誤

Error: Connect DevTools 
Wait timed out after 10094ms 

爲什麼Devtools在這種情況下不起來了。

回答

0

您應該運行無頭的Chrome這樣的:

chrome \ 
    --headless \     # Runs Chrome in headless mode. 
    --disable-gpu \    # Temporarily needed if running on Windows. 
    --remote-debugging-port=9222 \ 
    https://www.chromestatus.com # URL to open. Defaults to about:blank. 

Getting Start

看看