【问题标题】:Windows 10 : Chrome headless not doing anythingWindows 10:Chrome headless 什么都不做
【发布时间】:2017-12-13 09:33:51
【问题描述】:

在 Windows 10 中输入以下命令并启动无头 chrome 版本时,没有任何反应(有/无扩展):

"c:\Program Files (x86)\Google\Chrome\Application\chrome.exe" 
      --disable-extensions --headless --disable-gpu --print-to-pdf

它只是静默返回命令行,我找不到任何 pdf 文件。

有人遇到同样的问题并设法解决了吗?

我正在使用:Google Chrome 63.0.3239.84(官方版本)(64 位)(队列:63_win_84)

【问题讨论】:

标签: google-chrome-devtools


【解决方案1】:

Chrome 似乎没有在目录中写入的权限。
尝试使用 --enable-logging 标志启动命令。喜欢:
"c:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --enable-logging --disable-extensions --headless --disable-gpu --print-to-pdf
您将收到一个错误。修复它,它将开始工作。 您可以在这里找到更多信息:
How do I use Headless Chrome in Chrome 60 on Windows 10?

【讨论】:

  • 这工作,得到 [1224/095554.741:ERROR:headless_shell.cc(530)] 写入文件 output.pdf 不成功,无法打开文件:FILE_ERROR_ACCESS_DENIED
  • 添加位置后,它的工作原理,太棒了。 --print-to-pdf=c:\temp\output.pdf。谢谢
【解决方案2】:

我遇到了这个问题。

我的解决方案是下载 Canary Build for Chrome。 https://www.google.com/chrome/browser/canary.html

这将安装到 C:\User\userName\AppData\Local\Google\Chrome SxS\Application。尝试运行指向此安装的命令。

【讨论】:

    【解决方案3】:

    chrome 也需要完整路径。

    在 cmd.exe 中使用:

    start chrome --enable-logging --headless --disable-gpu --print-to-pdf=%cd%\output.pdf https://www.google.com/
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-01-03
      • 2017-01-06
      • 1970-01-01
      • 2023-04-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多