我尝试使用 selenium 和 webdriver_manager.chrome 抓取特定网站,而我的代码完全抓取了该网站的元素.但是爬取后,控制台窗口出现如下错误信息.
I tried crawling a specific site using selenium and webdriver_manager.chrome, and my code crawled elements of that site totally. But after crawling, the following error message appears in the console window.
ERROR:gpu_init.cc(426) Passthrough is not supported, GL is disabled
当我第一次找到它时,我取消了 chrome 的硬件硬件加速也没有解决问题.
When I first found it, I unchecked Hardware hardware accleration of chrome also it didn't solve the problem.
测试环境
Windows 操作系统,Chromedriver 版本 89,无头模式
Windows OS, Chromedriver vesion 89, headless mode
解决方案
我不确定这是否可以解决您的问题,因为错误消息略有不同.
I am not certain that this can be a solution for your question, since the error message is slightly different.
我没记错,错误消息 Passthrough is not supported, GL is swiftshader
在 Chromedriver 版本 89 之后显示为错误(但不确定)[1].
As I remember correctly, the error message Passthrough is not supported, GL is swiftshader
has been shown after the Chromedriver version 89 as a bug (but not certain) [1].
在 Windows 的情况下,需要 --headless
和 --disable-gpu
选项以使 chromedriver 以无头模式工作 [2].由于错误 [3],Linux 似乎也需要 --disable-gpu
.
In case of Windows, --headless
and --disable-gpu
options are required to make the chromedriver work as a headless mode [2]. It seems like --disable-gpu
is also required for Linux because of the bug [3].
如果同时删除 --headless
和 --disable-gpu
选项,则不会出现错误消息.但是,chromedriver 不再作为无头模式工作.
The error message does not appear if both --headless
and --disable-gpu
options are removed. However, the chromedriver does not work as a headless mode anymore.
在我的情况下,错误消息不会影响无头 chrome 的操作.正如我发现的那样,通常情况下,Chrome 会在没有 GPU 的情况下恢复工作.但是,为了获得一致的结果,遥测需要 GPU [4]."
In my case, the error message does not affect the operation of a headless chrome. As I found, "Normally, Chrome would just fall back to work without GPU. However, for consistent results, Telemetry requires the presence of GPU [4]."
我还应用了 --disable-software-rasterizer
选项来禁用 WebGL [5].无头操作下不再显示错误信息.
I've additionally applied --disable-software-rasterizer
option to disable WebGL [5]. The error message does not show anymore under the headless operation.
参考文献
[1] https://reddit.com/r/chrome/comments/n6qywt/hardware_acceleration_fail_in_chrome_on_linux/
[2] https://developers.google.com/web/updates/2017/04/headless-chrome
[3] https://bugs.chromium.org/p/chromium/问题/详细信息?id=737678
[4] https://groups.google.com/a/chromium.org/g/telemetry/c/bEgV1EH63eA
[5] https://bugs.chromium.org/p/chromium/问题/详细信息?id=617551
这篇关于不支持直通,GL 被禁用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!