如何在 Ubuntu 的无头 chrome 中启用 WebGL? [英] How do I enable WebGL in headless chrome in Ubuntu?

查看:42
本文介绍了如何在 Ubuntu 的无头 chrome 中启用 WebGL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 Ubuntu 14 的无头 chrome 中启用 webgl 或安装 webgl?我尝试安装 libosmesa6,但没有帮助.

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?

我想使用 webgl 来处理无头 chrome 和 selenium 测试?我正在使用 nightwatch 来运行测试.

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

推荐答案

这对我让 chrome 使用 osmesa 很有用

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

警告:当使用 osmesa 运行时,整个页面都使用 osmesa 呈现,因此速度很慢.因此,如果您有可以在没有 WebGL 的情况下运行的测试,您可能希望在没有 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.

另请注意,chrome 本身使用 osmesa 进行无头测试,但它使用特定版本.在回答这个问题时,它是 9.0.3 版.它还对此处

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

这篇关于如何在 Ubuntu 的无头 chrome 中启用 WebGL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆