【问题标题】:Measuring page loads programmatically in js在 js 中以编程方式测量页面加载
【发布时间】:2019-10-29 14:05:45
【问题描述】:

我正在寻找一种加载页面的方法(例如使用 selenium)、测量页面加载时间和网络调用统计信息。即我们可以从 Chrome devtools 网络选项卡中获得的类似信息:请求状态、类型、大小、时间等。

我已经尝试使用性能审计配置lighthouse。但我发现 lighthouse 生成的报告与 Chrome devtools 网络选项卡生成的报告不一致,see discussion on this thread

是否有可以用于此目的的 js 库?

【问题讨论】:

  • thisthis 讨论对您有帮助吗?
  • 非常感谢,这两个链接都很有帮助

标签: javascript selenium google-chrome-devtools pageload lighthouse


【解决方案1】:

感谢@DebanjanB 指出,我基本上可以在不需要外部库的情况下获得读取性能数据。

var performance = window.performance || window.mozPerformance || window.msPerformance || window.webkitPerformance || {};
var network = performance.getEntries() || {};

【讨论】:

    猜你喜欢
    • 2011-05-27
    • 1970-01-01
    • 1970-01-01
    • 2014-04-08
    • 2015-09-07
    • 2011-07-24
    • 2012-12-29
    • 1970-01-01
    • 2010-11-28
    相关资源
    最近更新 更多