How do I enable WebGL in headless chrome in Ubuntu?

*爱你&永不变心* 提交于 2019-11-26 12:29:43

问题


How do I enable webgl or install webgl in headless chrome in Ubuntu 14? I tried installing libosmesa6, but that did not help.

Can someone please point me in the right direction?

I want to use webgl to work with headless chrome and selenium tests? I am using nightwatch to run the tests.


回答1:


This worked for me to get chrome to use osmesa

sudo apt-get install libosmesa
sudo ln -s /usr/lib/x86_64-linux-gnu/libOSMesa.so.6 /opt/google/chrome/libosmesa.so
google-chrome --no-first-run --user-data-dir=~/chrome-stuff --use-gl=osmesa

Warning: When running with osmesa the entire page is rendered with osmesa making it pretty slow. So, if there are tests you have that can run without WebGL you probably want to run them without osmesa.

Also note that chrome itself uses osmesa to headless test but it uses a specific version. At the time of this answer it was version 9.0.3. It also makes a few changes listed here

Otherwise to run headless in general I found this

https://gist.github.com/addyosmani/5336747



来源:https://stackoverflow.com/questions/39040370/how-do-i-enable-webgl-in-headless-chrome-in-ubuntu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!