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

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

问题描述

如何在Ubuntu 14中启用webgl或在无头chrome中安装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来进行无头铬和硒测试吗?我正在使用夜表来运行测试.

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

否则我通常会无头运行

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

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

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