Run chrome as a part of lighthouse cli
See original GitHub issueI’ve been trying some stuff with finding chrome and spawning it as a part of CLI.
lighthouse <url>
- When connection fails to Remote Debugger, try launch chrome
- osx - find chrome and if there is more than 1 installation, use inquirer to let user select
- I don’t know how to tell when chrome remote-debugger is ready since I don’t get any message or event that tells it’s ready. So I poll(every 100ms) from the parent process(CLI) to connect to remote debugger and when it succeeds, we know that the remote-debugger is ready, then do lighthouse run.
- Poll for fixed number of retries and then reject when it crosses the retry limit.
- Kill chrome once everything is over - Only the chrome launched from the CLI is killed - not the one already running.
Ported shell scripts to JS for finding and launching chrome. The code is here - https://github.com/GoogleChrome/lighthouse/compare/master...boopathi:launch-chrome-js
Need some ideas and thoughts around this before I send a PR. Is this approach okay ? or do we want to keep running chrome as a separate foreground process?
Also, just curious, is there any other way to know that the remote-debugger has started when launched as a child process (instead of polling the port every 100ms)?
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Running Lighthouse Reports on the Command Line - Medium
This blog post shows you how to run Google Lighthouse on the command line and how to customize the reports. After reading this...
Read more >GoogleChrome/lighthouse: Automated auditing ... - GitHub
Run it: open Chrome DevTools, select the Lighthouse panel, and hit "Generate ... The Node CLI provides the most flexibility in how Lighthouse...
Read more >Lighthouse overview - Chrome Developers
You can run Lighthouse in Chrome DevTools, from the command line, or as a Node module. You give Lighthouse a URL to audit,...
Read more >An Introduction To Running Lighthouse Programmatically
One of the simplest ways to run Lighthouse is through Chrome's DevTools Lighthouse panel. If you open your site in Chrome and then...
Read more >How to Use and Customize Lighthouse - CLI & NodeJS
An introductory guide to the different parts of Google Lighthouse, how to use it via CLI and NodeJS, and strategies for customizing its ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
fwiw: @wwchen of the devtools team just wrote a little module along these lines: https://codereview.chromium.org/2337713002/ see
launch_chrome.js
It’s a little different as it only wants canary or chromium, but maybe theres something in there to steal. (Though admittedly the earlier patches here look pretty nice already 😃
Heh heh, no problem!
Nice on there with
launch_chrome
was planning to use exude 😇