0
在開發工具中使用Chrome 60時,有一些Audits Panel,其中有一些得分(由Lighthouse驅動)。 Progressive Web App,Performance,Accessibility和Best Practices頂部的分數是您每個類別的總分數。在Chrome中,如何在Javascript中獲得審覈小組得分
您是否認爲可以在Chrome中使用一些Javascript
代碼訪問這些分數?
在開發工具中使用Chrome 60時,有一些Audits Panel,其中有一些得分(由Lighthouse驅動)。 Progressive Web App,Performance,Accessibility和Best Practices頂部的分數是您每個類別的總分數。在Chrome中,如何在Javascript中獲得審覈小組得分
您是否認爲可以在Chrome中使用一些Javascript
代碼訪問這些分數?
您可以從the command line運行燈塔:
npm install -g lighthouse
lighthouse --output=json --output-path=./report.json https://airhorner.com/
這將產生一個./report.json
可以通過腳本來消耗。
也可以在節點腳本中運行Lighthouse。它沒有在文檔中描述過,但你可以看看other tools(例如webpack-lighthouse-plugin)是如何做的。
恐怕我現在沒有時間嘗試,但本頁上的說明看起來很有希望:https://developers.chrome.com/extensions/experimental_devtools_audits –
感謝您的鏈接。我要去看。 – LeMoussel
Hummm ;;; 「使用chrome.experimental.devtools.audits API將新的審覈類別添加到」開發者工具審覈「面板中。」我沒有找到API來獲取像Lighthouse這樣的審計數據。 – LeMoussel