問(wèn)題描述
我嘗試使用 selenium 和 webdriver_manager.chrome 抓取特定網(wǎng)站,而我的代碼完全抓取了該網(wǎng)站的元素.但是爬取后,控制臺(tái)窗口出現(xiàn)如下錯(cuò)誤信息.
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
當(dāng)我第一次找到它時(shí),我取消了 chrome 的硬件硬件加速也沒(méi)有解決問(wèn)題.
When I first found it, I unchecked Hardware hardware accleration of chrome also it didn't solve the problem.
推薦答案
測(cè)試環(huán)境
Windows 操作系統(tǒng),Chromedriver 版本 89,無(wú)頭模式
Windows OS, Chromedriver vesion 89, headless mode
解決方案
我不確定這是否可以解決您的問(wèn)題,因?yàn)殄e(cuò)誤消息略有不同.
I am not certain that this can be a solution for your question, since the error message is slightly different.
我沒(méi)記錯(cuò),錯(cuò)誤消息 Passthrough is not supported, GL is swiftshader
在 Chromedriver 版本 89 之后顯示為錯(cuò)誤(但不確定)[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
選項(xiàng)以使 chromedriver 以無(wú)頭模式工作 [2].由于錯(cuò)誤 [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].
如果同時(shí)刪除
--headless
和--disable-gpu
選項(xiàng),則不會(huì)出現(xiàn)錯(cuò)誤消息.但是,chromedriver 不再作為無(wú)頭模式工作.
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.
在我的情況下,錯(cuò)誤消息不會(huì)影響無(wú)頭 chrome 的操作.正如我發(fā)現(xiàn)的那樣,通常情況下,Chrome 會(huì)在沒(méi)有 GPU 的情況下恢復(fù)工作.但是,為了獲得一致的結(jié)果,遙測(cè)需要 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]."
我還應(yīng)用了 --disable-software-rasterizer
選項(xiàng)來(lái)禁用 WebGL [5].無(wú)頭操作下不再顯示錯(cuò)誤信息.
I've additionally applied --disable-software-rasterizer
option to disable WebGL [5]. The error message does not show anymore under the headless operation.
參考文獻(xiàn)
[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/問(wèn)題/詳細(xì)信息?id=737678
[4] https://groups.google.com/a/chromium.org/g/telemetry/c/bEgV1EH63eA
[5] https://bugs.chromium.org/p/chromium/問(wèn)題/詳細(xì)信息?id=617551
這篇關(guān)于不支持直通,GL 被禁用的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!