我正在使用无头的chrome截屏。但是,在添加超时时,该进程不会退出,而是保持活动状态...是否有办法在发生错误(如超时)时终止该进程?
没有超时的命令及其输出(此命令正在工作):
>>> chrome --headless --screenshot --no-sandbox https://stackoverflow.com
[0808/174530.681784:ERROR:gpu_process_transport_factory.cc(1016)] Lost UI shared context.
Fontconfig warning: "/etc/fonts/fonts.conf", line 146: blank doesn't take any effect anymore. please remove it from your fonts.conf
[0808/174531.735502:ERROR:cert_verify_proc_nss.cc(981)] CERT_PKIXVerifyCert for securepubads.g.doubleclick.net failed err=-8179
[0808/174532.060892:INFO:headless_shell.cc(590)] Written to file screenshot.png.
>>>
具有超时命令(测试时为1ms)及其输出(待处理)的命令:
>>> chrome --headless --screenshot --no-sandbox --timeout=1 https://stackoverflow.com
[0808/174256.720003:ERROR:gpu_process_transport_factory.cc(1016)] Lost UI shared context.
Fontconfig warning: "/etc/fonts/fonts.conf", line 146: blank doesn't take any effect anymore. please remove it from your fonts.conf
[0808/174256.772496:INFO:headless_shell.cc(344)] Timeout.