Replies: 1 comment
-
The destination page (https://github.com/GoogleChrome/lighthouse/issues/url) is only showing the desired content if the user arrived after clicking the "I agree" button. Lighthouse in DevTools will always navigate to the URL directly, so the Lighthouse navigation won't have the same authorization as clicking the "I agree" button.
There are a couple options:
const puppeteer = require('puppeteer');
const fs = require('fs');
const open = require('open');
const lighthouse = require('lighthouse/lighthouse-core/fraggle-rock/api.js');
const config = {
extends: 'lighthouse:default',
settings: {
output: 'html',
},
};
(async () => {
const browser = await puppeteer.launch({
executablePath: process.env.CHROME_PATH,
ignoreDefaultArgs: ['--enable-automation'],
headless: false,
})
const page = await browser.newPage();
await page.goto('https://wponline.mom.gov.sg/WPOLLoginController?action=WPOLLoginAction&actionType=WPOLNonLogin');
const {report} = await lighthouse.navigation(async () => {
// CSS selector of the "I agree" button
await page.click('body > form > table:nth-child(14) > tbody > tr > td > input[type=submit]:nth-child(1)');
}, {page, config});
fs.writeFileSync('report.html', report);
open('report.html');
await page.close();
await browser.close();
})(); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Dear Lighthouse team
We are running performance scans our client for this website: https://wponline.mom.gov.sg/WPOLOMController
(To access the page, please visit this URL and select the "I Agree" button)
Issue:
When we run Performance scans on Google Lighthouse (for the URL: "https://wponline.mom.gov.sg/WPOLOMController"), we are redirected to this error page with the following message:
The results captured by Lighthouse is that for the error page and not the website itself.
Questions:
Appreciate if the Lighthouse team could:
(i) shed some insights into what is happening, and
(ii) what the web developers should do to rectify the issue?
Thank you
Beta Was this translation helpful? Give feedback.
All reactions