问题
There's a website I need to do a full audit on, but I'm wondering if there's any way to make Lighthouse do it. I know they don't support full site audits or multiple URLs, but I found out that it could maybe be done with using bash scripts. So I would appreciate any help on this case! Or maybe any Lighthouse alternatives you'd recommend?
Thank you in advance!
回答1:
In my company, we wanted to collect website's performance data on most of the pages on our landing website, app product, and also our rivals' product, so sometimes there are hundreds of URLs that need to be audited.
I created a tool:
lighthouse-batch-parallel
which could audit multiple URLs. You can get the report result in JS Object, JSON, CSV stream, or you can just use the provided cli-tool to generate the report in .csv
or .json
.
回答2:
It is possible to audit multiple URLs,as long as you loop over some array of urls programatically. I suggest first launching your chrome instance with chromeLauncher, then either launchings chrome for each url and writing results to some result directory in parallel, or do the same action but sequentially. When you have received the results from all of the urls, kill the chrome launcher and node process.
回答3:
I came across the same problem and while looking for a good solution came across this nifty little package - lighthouse-batch
All I had to do was run the following by passing URL's separated by a comma:
lighthouse-batch -s https://www.url1.com,https://www.url2.com,https://www.url3.com
You also get the summary of all the sites passed in a single summary.json
file as well as a detailed report for each site by under the file site_url.json
回答4:
Shameless self promotion, but I wrote the Multihouse Node app to run Lighthouse for multiple URLs.
The app takes URLs and optional metadata from an input CSV file (one row per URL), runs one or more audits, and outputs median scores to an output CSV file.
You can specify multiple different options from the command line.
For example:
- The number of times Lighthouse is run for each URL. The default is three.
- Whether to calculate the average or median scores for all the runs. The default is median.
- Which Lighthouse audits to run. The default is all audits: Performance, Best practice, PWA, Accessibility, SEO.
- Whether to include results for all individual audits or for Web Vitals.
You might also want to take a look at Related projects on the Lighthouse GitHub repo.
来源:https://stackoverflow.com/questions/52223330/lighthouse-multiple-urls