You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Launch Lighthouse on any website in the globe using our customized web view, which renders the Chrome browser. Should be able to generate report before and after login.
#16005
Open
Chandan-TY opened this issue
May 16, 2024
· 3 comments
Right now, I'm attempting to use Node.js to run Lighthouse in an electron application. The issue is that, every time I use the lighthouse (URL), I always end up on the login page for every website that has been authenticated once I log in. How can I get the results for any number of websites logged into our web view that are authenticated pages? It won't be possible for us to pass all of the credentials for every website. I need to find a way for Lighthouse to retrieve the login credentials from our web view in the Chrome browser and display the results for each page that the user is currently connected into.
Here is an example of the code I would like to run:
import fetch from 'node-fetch';
import puppeteer from 'puppeteer';
const chromeLauncher = require('fix-esm').require('chrome-launcher');
import { generateLighthouseReport } from './helper';
Any solutions on how I can get past the problem or potentially work around it?
What did you expect?
In order to deliver the results for any website that the users are logged into, I need the Lighthouse to retrieve the login credentials from our Chrome browser web view.
Chandan-TY
changed the title
Run Lighthouse on any web application in the world on our custom web view where we render chrome browser inside our web view before and after login
Launch Lighthouse on any website in the globe using our customized web view, which renders the Chrome browser both before and after login.
May 16, 2024
Chandan-TY
changed the title
Launch Lighthouse on any website in the globe using our customized web view, which renders the Chrome browser both before and after login.
Launch Lighthouse on any website in the globe using our customized web view, which renders the Chrome browser. Should be able to generate report before and after login.
May 17, 2024
Which of the solutions have you tried? The code you provided doesn't appear to be using any of them.
Hi @adamraine
Thanks for your quick reply.
I would appreciate knowing how to manage our situation because there isn't a solution offered.
How can we tell Lighthouse to use our browser's web view to retrieve the credentials, or is there another way to do this? Is there anything that has to be configured for Lighthouse to select the login credentials from our web browser?
Opens that page in a separate Chrome instance in the background
Runs Lighthouse on the page URL using the background Chrome instance
And you want to know how to transfer the login credentials from the Electron web view to the background Chrome instance used for testing Lighthouse.
If you save logged in state using Cookies this solution would be most useful. As for retrieving logged-in credentials from Electron I really don't know as I have no experience with it
Summary
URL before login
https://www.naukri.com/
https://accounts.google.com/InteractiveLogin/signinchooser?continue=https%3A%2F%2Fmail.google.com%2Fmail%2Fu%2F0%2F&emr=1&followup=https%3A%2F%2Fmail.google.com%2Fmail%2Fu%2F0%2F&osid=1&passive=1209600&service=mail&ifkv=AaSxoQyDIyyAsCS4dbNNYaIunO8tmilgA_WuH-_PhFnzgrACUKr_c_qiSrt1_xV_-oMTY6n7eWum0g&ddm=0&flowName=GlifWebSignIn&flowEntry=ServiceLogin
URL after login
https://www.naukri.com/mnjuser/homepage
https://mail.google.com/mail/u/0/#inbox
What happened?
Right now, I'm attempting to use Node.js to run Lighthouse in an electron application. The issue is that, every time I use the lighthouse (URL), I always end up on the login page for every website that has been authenticated once I log in. How can I get the results for any number of websites logged into our web view that are authenticated pages? It won't be possible for us to pass all of the credentials for every website. I need to find a way for Lighthouse to retrieve the login credentials from our web view in the Chrome browser and display the results for each page that the user is currently connected into.
Here is an example of the code I would like to run:
import fetch from 'node-fetch';
import puppeteer from 'puppeteer';
const chromeLauncher = require('fix-esm').require('chrome-launcher');
import { generateLighthouseReport } from './helper';
const getReport = async () => {
const {
srcUrl,
formValues: { device, categories },
} = arg;
try {
const chrome = await chromeLauncher.launch({
chromePath: chromePaths.chrome,
chromeFlags: ['--headless'],
});
} catch (err) {
log.info(err);
event.reply('generate-perf-report', {
isError: true,
result: err,
});
}
}
helper.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateLighthouseReport = void 0;
// @ts-ignore
async function generateLighthouseReport(...args) {
const lighthouseModule = await import('lighthouse');
const lighthouse = lighthouseModule.default;
// @ts-ignore
return lighthouse(...args);
}
exports.generateLighthouseReport = generateLighthouseReport;
//# sourceMappingURL=lighthouse.js.map
Any solutions on how I can get past the problem or potentially work around it?
What did you expect?
In order to deliver the results for any website that the users are logged into, I need the Lighthouse to retrieve the login credentials from our Chrome browser web view.
What have you tried?
I have tried the solutions provided in the below link
https://github.com/GoogleChrome/lighthouse/blob/main/docs/authenticated-pages.md
How were you running Lighthouse?
Nodejs programmatically
Lighthouse Version
v12.0.0
Node Version
v20.13.1
OS
Windows, MAC & linux
Attachments
Lighthouse.before.and.after.login.issue.mp4
The text was updated successfully, but these errors were encountered: