Home:ALL Converter>How to run Lighthouse programmatically behind an authentication wall?

How to run Lighthouse programmatically behind an authentication wall?

Ask Time:2019-10-10T00:03:42         Author:aBlaze

Json Formatter

I would like to run a Lighthouse audit behind an authentication wall. For example, below I tried to run Lighthouse using PageSpeed Insights to a URL that usually resolves to my Gmail account. However, as seen below, the Lighthouse audit ran against the sign in page, not my Gmail.

enter image description here

Therefore, how can I run Lighthouse programmatically behind an authentication wall? I understand that I can log in to a page, navigate to the DevTools -> Audits page, and manually run an audit; however, I would like to figure out a way to do this programmatically (via PageSpeed Insights API call or via DevTools in a programmatic way is best, but via NodeJS is OK too).

Author:aBlaze,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/58308106/how-to-run-lighthouse-programmatically-behind-an-authentication-wall
GrahamTheDev :

You cannot do this 'out of the box' with just lighthouse.\n\ngoogle-lighthouse-puppeteer however allows you to use puppeteer to handle the login first and then run lighthouse.\n\nIt is a steep learning curve but once you master puppeteer it opens up lots of automated testing capabilities.",
2019-10-10T19:58:31
yy