GoogleChrome / lighthouse

Automated auditing, performance metrics, and best practices for the web.
https://developer.chrome.com/docs/lighthouse/overview/
Apache License 2.0
28.03k stars 9.32k forks source link

CLI, Node: Performance Score null if running headless #11131

Open adrian-cerdeira opened 3 years ago

adrian-cerdeira commented 3 years ago

Provide the steps to reproduce

  1. Run Lighthouse CLI on URL https://www.viag.ch
  2. Use parameters --chrome-flags="--headless"

What is the current behavior?

If parameter headless is used, the performance score is zero. This leads to an error with LCP. image But if headless parameter is not used, then the LCP error get ignored and the score is between 0.9 -1.

What is the expected behavior?

Performance score should be between 0 to 1.

Environment Information

patrickhulce commented 3 years ago

Thanks for filing @adrian-cerdeira! I'm not able to reproduce this with your specified environment settings though.

This is what I get image image

Are you 100% sure it's using Chrome 83? This is the sort of error message you would get if it were using an older Chromium version.

adrian-cerdeira commented 3 years ago

Here the proof: image Also here is the command I have executed, maybe I am doing something wrong: lighthouse https://www.viag.ch --chrome-flags="--headless"

patrickhulce commented 3 years ago

That's the correct command 👍 I'm not sure what's going on, and I don't know how we can help if we can't reproduce it :/

Is it possible this page serves different content to your geo and my geo? (I'm based in the central US)

adrian-cerdeira commented 3 years ago

It could be. My geo is based from switzerland.

aseem-upadhyay commented 3 years ago

in my case. if i run the test in a dockerised environment, it works fine when checking for desktop but returns a score of null when executing for mobile.

However, the same command if i run from my terminal, works fine for both desktop and mobile.

Not sure what's causing this

Environment Information Lighthouse version: 7.0.1 Node version: 12.20.1

wafendy commented 3 years ago

I'm also getting performance is null most of the time. The error message I'm getting is:

Chrome didn't collect any screenshots during the page load. 
Please make sure there is content visible on the page, and 
then try re-running Lighthouse. (NO_SCREENSHOTS)

For detailed docker setup can see this post: https://stackoverflow.com/questions/66251473/chrome-aws-lambda-lighthouse-always-results-in-error-connect-econnrefused-127/66256129#66256129

paulirish commented 1 year ago

I would also suggest folk running into this try --headless=chrome which is a new (mode) for headless which has much more headful behavior while still being headless. :)