question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Run chrome as a part of lighthouse cli

See original GitHub issue

I’ve been trying some stuff with finding chrome and spawning it as a part of CLI.

lighthouse <url>

  1. When connection fails to Remote Debugger, try launch chrome
  2. osx - find chrome and if there is more than 1 installation, use inquirer to let user select
  3. 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.
  4. Poll for fixed number of retries and then reject when it crosses the retry limit.
  5. 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:closed
  • Created 7 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
paulirishcommented, Sep 12, 2016

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 😃

0reactions
hemanthcommented, Sep 13, 2016

(Edited by paulirish. removed the gif cuz it creeped me out, sorry! 😃

Heh heh, no problem!

Nice on there with launch_chrome was planning to use exude 😇

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found