Answer the question
In order to leave comments, you need to log in
How do I connect Lighthouse to my current Chromium instance running through Puppeteer?
I open a chrome instance through Puppeteer, do some actions in a new tab, then I need to open a tab in the same window (or in the current tab opened through Puppeteer) launch Lighthouse. As I did not change the configs, the lighthouse still opens a new window.
if (browserWSEndpoint) {
browser = await puppeteer.connect({browserWSEndpoint});
} else {
browser = await puppeteer.launch({
headless: false,
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
],
});
browserWSEndpoint = await browser.wsEndpoint();
}
//.....
const options = {
logLevel: 'error',
output: 'json',
onlyCategories: ['performance', 'seo'],
port: (new URL(browserWSEndpoint)).port,
};
const {lhr} = await lighthouse(url, options);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question