Skip to content
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

CLI flag to choose whether to open a new lighthouse page or not #16259

Open
Shivam93937 opened this issue Nov 25, 2024 · 4 comments
Open

CLI flag to choose whether to open a new lighthouse page or not #16259

Shivam93937 opened this issue Nov 25, 2024 · 4 comments

Comments

@Shivam93937
Copy link

Shivam93937 commented Nov 25, 2024

Feature request summary

A CLI flag (something like --reuse-page) to re-use the existing page that was running on the browser that puppeteer connects to.
The page can be selected from await lhBrowser.pages().

Are you willing to work on this yourself?
Yes

What is the motivation or use case for changing this?
It will help run lighthouse programmatically inside applications like CEF and Electron where opening a new page (by default) causes a failure when connecting to it through remote debugging port.

How is this beneficial to Lighthouse?
It will widen the audience to which lighthouse can be used and increase the tool's users.

Mentioned the changes in the screenshot:
lh module changes

@adamraine
Copy link
Member

This should be possible already with the Node API: https://github.com/GoogleChrome/lighthouse/blob/main/docs/puppeteer.md#option-1-launch-chrome-with-puppeteer-and-handoff-to-lighthouse

Is there a use case where you need to use the CLI and can't use the Node API?

@Shivam93937
Copy link
Author

@adamraine I need to use the functionalities provided by lighthouse CI, (is-median runs, multiple runs, etc.) I cannot use node API if I want to use LIghthouse CI.

@adamraine
Copy link
Member

Gotcha. I think a solution in Lighthouse CLI could be tricky because the CLI can still connect to an existing browser instance with multiple tabs open. Maybe a quick solution would be to re-use a page if it's the only page open.

@Shivam93937
Copy link
Author

Yes agreed, this is the solution i proposed and I need a CLI flag for this, or I will have to fork and maintain the mono repo lhci and lighthouse too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants