从请求获取资源大小

时间:2018-10-26 20:44:12

标签: php laravel laravel-dusk spatie

我们正在使用Laravel Dusk来获取网站并声明一些内容。我们需要做的几件事情包括获取页面的整个大小以及图像的大小。

类似于打开Chrome浏览器,查看“网络”标签并刷新页面,我们可以在那里看到资源及其大小,而在底部,我们有响应的总大小(或有效负载)-包含所有图像, css和js文件。

呼叫$browser->driver->manage()->getLog('browser')仅具有控制台错误,而$browser->driver->manage()->getLog('driver')为空白。

我们曾经使用PhantomJS,因此可以利用onResourceReceived-http://phantomjs.org/api/webpage/handler/on-resource-received.html

我注意到Google Puppeteer似乎有可能-https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#event-requestfinished

我研究了使用https://github.com/spatie/browsershot的方法,因为它使用的是Puppeteer,但对我而言并没有什么特别的。

使用Laravel Dusk或Spatie的Browsershot是否可以登录并获取页面资产/资源的大小?

0 个答案:

没有答案