Using lighthouse in combination with Puppeteer
See original GitHub issueHello,
I’m would like to launch a chrome instance, connect puppeteer
to it to login, and then start lighthouse
, is that possible ? I couldn’t find a way to connect puppeteer
to a chrome instance started with chrome-launcher
.
I’ve tried something like this but with no success
function launchChromeAndRunLighthouse(url, opts, config = null) {
return chromeLauncher.launch({chromeFlags: opts.chromeFlags}).then(async chrome => {
opts.port = chrome.port;
const url = 'ws://localhost:' + chrome.port + '/devtools/browser/';
const browser = await puppeteer.connect({
browserWSEndpoint: url
});
// this throws the following WS error: (node:9000)
// UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: unexpected server response (404)
because I’m missing the browser id after browser/
and it doesn’t seem to be exposed by lighthouse
I’ve seen issues where it says to manually connect before running lighthouse
on a website where login is mandatory. Is there any other fully automated way to do this ?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:17 (6 by maintainers)
Top Results From Across the Web
Client-Side Perf Testing Using Lighthouse CI With Puppeteer
Step 3: Run below 2 commands to add Lighthouse CI and Puppeteer dependencies. Step 4: Open any editor of choice.
Read more >Making Better Use of Lighthouse with Puppeteer
Lighthouse is a useful tool that can evaluate the performance, accessibility, and the use of web development best practices on our websites ...
Read more >Lighthouse user flows - web.dev
Puppeteer is used to script page loads and trigger synthetic user interactions, and Lighthouse can be invoked in multiple ways to capture key ......
Read more >Performance Testing Authenticated Pages with Lighthouse
The below example will use Puppeteer in conjunction with Lighthouse to test authenticated pages. First, add Puppeteer to your dependencies
Read more >Automated Lighthouse Reporting using Puppeteer | Buddy
Automated Lighthouse Reporting using Puppeteer · npm init # Create your package. · touch lighthouse-util. · import puppeteer from "puppeteer"; ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This should work:
@Antonhansel what’s the use case for using chrome-launcher? Why not just launch chrome using puppeteer?