Webshot gem无法捕获完成的页面 [英] Webshot gem is not capturing the finished page

查看:96
本文介绍了Webshot gem无法捕获完成的页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用mapbox生成的地图的屏幕截图.我成功拍摄了屏幕截图,直到开始将数据存储到文件中为止,如果您有很多数据,mapbox建议使用. ( https://www. mapbox.com/help/working-with-large-geojson-data/#store-geojson-at-url )

I am attempting to take screen shots of maps generated with mapbox. I successfully took screenshots until I started storing my data in a file, which mapbox recommends if you have a lot of data. (https://www.mapbox.com/help/working-with-large-geojson-data/#store-geojson-at-url)

现在我得到一个白屏.

我添加了一个超时时间.我等待多长时间似乎并不重要.

I've added a timeout. It doesn't seem to matter how long I wait.

我认为数据应该通过Ajax加载.我正在针对本地运行的Web服务器运行它.当我使用Web浏览器查看页面时,会看到对数据文件的请求.通过Webshot加载页面时,不会尝试加载数据文件.某些东西阻塞了,否则在尝试加载数据之前就停止了.

I believe the data should be loaded via Ajax. I'm running this against a locally running web server. When I view the page using a web browser I see a request for the data file. When the page is loaded via Webshot, there is no attempt to load the data file. Something blocks or it otherwise stops before it tries to load the data.

有什么想法吗?

推荐答案

受上述Ken的问题的启发,我进行了逐层研究. Webshot是围绕水豚的一个相对简单的包装器,它通过poltergeist宝石与phantomjs进行交互. Phantomjs有一些简单的教程,可指导您逐步与网页进行交互( http://phantomjs. org/quick-start.html#page-loading ).

Inspired by Ken's questions above, I investigated layer by layer. Webshot is a relatively simple wrapper around capybara, which interacts with phantomjs via the poltergeist gem. Phantomjs has some simple tutorials that step you through interacting with web pages (http://phantomjs.org/quick-start.html#page-loading).

当我要求phantomjs加载我的页面时,我立即看到一个错误:类似未定义webgl".

When I asked phantomjs to load my page I immediately saw an error: something like "webgl not defined".

我正在使用需要webgl的Mapbox GL JS. Phantomjs不支持webgl( http://phantomjs.org/supported-web-standards.html ).

I was using Mapbox GL JS, which requires webgl. Phantomjs does not support webgl (http://phantomjs.org/supported-web-standards.html).

因此,尽管我的较新页面在浏览器中可以正常工作,但它永远无法在phantomjs中工作.

So, while my newer page worked fine in a browser, it was never going to work in phantomjs.

我感到困惑的部分是该页面的早期版本在浏览器和phantomjs中都可以使用.然后我发现我们进行了更改,并且该更改将Mapbox js库从Mapbox.js间接更改为mapbox-gl.js.

Part of my confusion was that an earlier version of the page worked in both the browser and phantomjs. Then I discovered that we made a change and that change indirectly changed our Mapbox js library from Mapbox.js to mapbox-gl.js.

解决方案是使用mapbox.js(而不是Mapbox-gl.js).

The solution was to use mapbox.js (not Mapbox-gl.js).

我们是通过leaflet.js( http://leafletjs.com/)完成的.

We did this via leaflet.js (http://leafletjs.com/).

感谢大家的帮助.

这篇关于Webshot gem无法捕获完成的页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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