-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
docs(puppeteer.md): examples of combining the two #4408
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea that's fair. I can cook up a slightly different example of doing something in pptr then use lighthouse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Const typo
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Lighthouse' rather than 'lighthouse' I think...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice work on these. They are indeed the best existing solutions to the problem.
R: @paulirish