简体   繁体   English

在Chrome中,如何在Javascript中获得审核小组分数

[英]In Chrome, How to get audit panel score in Javascript

With Chrome 60 in Dev Tools, there is an Audits Panel with some scores (powered by Lighthouse ). 借助开发工具中的Chrome 60,有一个带有某些分数的审核面板 (由Lighthouse提供支持)。 The scores at the top for Progressive Web App, Performance, Accessibility, and Best Practices are your aggregate scores for each of those categories. 渐进式Web应用程序,性能,可访问性和最佳实践顶部的分数是您对这些类别中每个类别的综合分数。

Do you think, it is possible to access these scores with some Javascript code within Chrome? 您认为,可以在Chrome中使用一些Javascript代码访问这些分数吗?

You can run Lighthouse from the command line : 您可以从运行灯塔的命令行

npm install -g lighthouse
lighthouse --output=json --output-path=./report.json https://airhorner.com/

This will produce a ./report.json that can be consumed by your script. 这将生成一个./report.json ,您的脚本可以使用它。


It's also possible to run Lighthouse from within your node script. 也可以从节点脚本中运行Lighthouse。 It's not described in the docs, but you can check out how other tools (eg webpack-lighthouse-plugin ) are doing it. 文档中没有对此进行描述,但是您可以查看其他工具 (例如webpack-lighthouse-plugin)是如何进行的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM