gpt4 book ai didi

google-chrome - 在 Ubuntu 上运行 headless chrome

转载 作者:太空宇宙 更新时间:2023-11-03 17:11:47 28 4
gpt4 key购买 nike

我正在尝试在 Ubuntu 上使用以下命令运行 headless (headless) Chrome。

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 在这种情况下没有启动。

最佳答案

你应该像这样运行 Headless 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

关于google-chrome - 在 Ubuntu 上运行 headless chrome,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35205735/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com