-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Can't connect playwright to lighthouse. Getting 426 error #5956
Comments
You should pass 8041 as the port to lighthouse. |
const playwright = require('playwright');
const lighthouse = require('lighthouse');
async function main() {
const context = await playwright.chromium.launchPersistentContext('foo', {
args: [`--remote-debugging-port=8041`],
headless: false,
});
const [ page ] = context.pages();
await page.goto('https://old.reddit.com');
// login here
const result = await lighthouse('https://old.reddit.com', { port: 8041, disableStorageReset: true, disableDeviceEmulation: true });
await context.close();
console.log(JSON.stringify(result.lhr, null, 2));
}
main(); |
Lighthouse will only use default context, so you need to use |
Yup it works like a charm. Thank you |
Sorry to jump in here @pavelfeldman when running your example for certain sites, the following error occurs from LH:
This can work if we just avoid using the page.goto(), but since I need to add some JS into the page I see no way around that. |
Context:
Describe the bug
I want to connect playwright and have lighthouse report on the instance but struggling to get it working. I have got it working with chrome launcher but I would prefer not to rely on another package for this, especially in CI.
Am I missing something here? 🤔
Code Snippet
Error
The text was updated successfully, but these errors were encountered: