admin管理员组

文章数量:1295874

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 remend?

Thank you in advance!

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 remend?

Thank you in advance!

Share asked Sep 7, 2018 at 13:13 alienalien 511 silver badge5 bronze badges 6
  • you could make a shell or batch script to loop over the urls and make a call for each one... what OS are you using? – user9886608 Commented Sep 15, 2018 at 3:02
  • I'm using windows – alien Commented Sep 18, 2018 at 9:00
  • Then check en.m.wikipedia/wiki/Batch_file . You can use it to makea little script to loop over all your pages – user9886608 Commented Sep 18, 2018 at 18:22
  • The script file is done and working, but now I'm trying to figure out if there's any way to make it save the html file reports with full url as their names. – alien Commented Sep 24, 2018 at 9:28
  • Well, this is matter of a new question – user9886608 Commented Sep 24, 2018 at 12:22
 |  Show 1 more ment

5 Answers 5

Reset to default 2

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 ma:

lighthouse-batch -s https://www.url1.,https://www.url2.,https://www.url3.

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

In my pany, 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.

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.

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 mand 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.

Nowadays it can be achieved using lhci, a tool to automate accessibility reports with Lighthouse and optionally store it in a dedicated server.

Lhci has the collect mand that runs for multiple urls if provided.

lhci autorun --collect.url=http://example-1. --collect.url=http://example-2.

or creating a file lighthouserc.js

{
  "ci": {
    // ...,
    "collect": {
      "url": ["http://example-1.", "http://example-2."]
    }
  }
}

Taken from this Github issue: https://github./GoogleChrome/lighthouse-ci/issues/124

本文标签: javascriptLighthouse Multiple URLsStack Overflow