在开发工具中的 Chrome 60 中,有一个 Audits Panel有一些分数(由 Lighthouse 提供支持)。渐进式 Web 应用程序、性能、可访问性和最佳实践顶部的分数是每个类别的总分数。
您认为可以在 Chrome 中使用一些 Javascript
代码访问这些分数吗?
最佳答案
您可以从 the command line 运行 Lighthouse :
npm install -g lighthouse
lighthouse --output=json --output-path=./report.json https://airhorner.com/
这将生成一个可供您的脚本使用的 ./report.json
。
也可以从节点脚本中运行 Lighthouse。文档中没有描述,但您可以查看如何 other tools (例如 webpack-lighthouse-plugin )正在这样做。
关于javascript - 在 Chrome 中,如何在 Javascript 中获取审核小组分数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46196786/