lighthouse-batch
lighthouse-batch copied to clipboard
How to disable the emulatedUserAgent?
I use lighthouse-batch -s <url1,url2> --params "--chrome-flags="--screenEmulation.disable --screenEmulation.mobile=false --screenEmulation.width=1350 --screenEmulation.height=940 --no-emulatedUserAgent"" --html ./report.html but the device has always been emulation device.
One workaround would be to create a configuration file for use with lighthouse. For example, a file called config.js could be created with (update for your requirements):
const config = {
extends: "lighthouse:default",
settings: {
formFactor: "desktop",
throttling: {
rttMs: 40,
throughputKbps: 10 * 1024,
cpuSlowdownMultiplier: 1,
requestLatencyMs: 0,
downloadThroughputKbps: 0,
uploadThroughputKbps: 0,
},
screenEmulation: {
mobile: false,
width: 1907,
height: 1094,
deviceScaleFactor: 1,
disabled: false,
},
emulatedUserAgent:
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4695.0 Safari/537.36 Chrome-Lighthouse",
},
};
module.exports = config;
Then this would be called like this:
lighthouse-batch -s <url1,url2> --params "--config-path=config.js" --html
More details on lighthouse configuration can be found here: https://github.com/GoogleChrome/lighthouse/blob/master/docs/configuration.md
Thanks for your suggestion. I was sucessed with config file. But I have another question, how to run sites.txt for many tinmes with lighthouse-batch? for example, how to run "url" 5 times?
You can create a file containing a list of URLs separated on new lines and then run a command like lighthouse-batch -f ./test_sites.txt
to run a series of urls. To see more you can look at the all options section of the read me.
You can create a file containing a list of URLs separated on new lines and then run a command like
lighthouse-batch -f ./test_sites.txt
to run a series of urls. To see more you can look at the all options section of the read me.
emmm...My sites.txt cotain 60 urls, but i need to run them 5 times to get the average score. Is there a way to solve it?