docs(puppeteer.md): examples of combining the two#4408
Conversation
patrickhulce
left a comment
There was a problem hiding this comment.
Thanks so much for jumping on this @ebidel :)
docs/puppeteer.md
Outdated
| **Note**: https://github.com/GoogleChrome/lighthouse/issues/3837 tracks the discussion for making Lighthouse work in concert with Puppeteer. | ||
| Some things are possible today (login to a page using Puppeteer, audit it using Lighthouse) while others (A/B testing the perf of UI changes) are not. | ||
|
|
||
| ### Custom network throttle settings using Puppeteer |
There was a problem hiding this comment.
Could we advertise a different example of using puppeteer? Perhaps just logging in to your page with the second example you've already got?
Our preferred method of customizing throttling is already documented and jumping in to muck with those settings in puppeteer is bound to result in over confidence in the accuracy of the performance metrics for those conditions.
There was a problem hiding this comment.
Yea that's fair. I can cook up a slightly different example of doing something in pptr then use lighthouse.
pedro93
left a comment
There was a problem hiding this comment.
It would probably make sense to showcase an example of interacting with a page such that it’s state changes (e.g: login) before executing lighthouse on it.
docs/puppeteer.md
Outdated
| Puppeteer can reconnect to this existing browser instance like so: | ||
|
|
||
| ```js | ||
| onst chromeLauncher = require('chrome-launcher'); |
|
Changed to an example that injects css. As noted, it uses the protocol api instead of the pptr API to do so, but we can update the snippet when that starts working. I think the important bit for this doc is to show how to use puppeteer w/ LH. Login is another example that I can add later. |
|
does it make sense to indent the async functions? not that it really matters but I just like that more 🙄 Thanks a lot @ebidel! |
|
I usually don't b/c it creates unnecessary indentation. But happy to if that's what people want. |
docs/puppeteer.md
Outdated
| Flow: | ||
| 1. disable the throttling settings in Lighthouse. | ||
| 2. Launch Chrome using Puppeteer and tell Lighthouse to reuse Puppeteer's chrome instance. | ||
| 3. Tell lighthouse to programmatically load the page. |
There was a problem hiding this comment.
'Lighthouse' rather than 'lighthouse' I think...
paulirish
left a comment
There was a problem hiding this comment.
nice work on these. They are indeed the best existing solutions to the problem.
R: @paulirish