Replies: 2 comments
-
It depends. Our example of puppeteer you link to is non-deterministic.
Only insomuch as processing that extra stylesheet if it were part of the page itself delays processing.
Because you'd then be analyzing two completely different pages in the same run. The test would be tainted by the resources and partial load of the original page. If this is what you want to accomplish, I highly recommend just creating a new URL to host that optimized content version (proxy server if you must). #11313 is an effort to bring much tighter integrations with puppeteer, but even after that work is complete, racily attempting to replace the entire page content will still be ill advised. |
Beta Was this translation helpful? Give feedback.
-
Yes, a reverse proxy is my current solution. Thanks for your help. |
Beta Was this translation helpful? Give feedback.
-
You have an example of how to use puppeteer with lighthouse here:
https://github.com/GoogleChrome/lighthouse/blob/master/docs/puppeteer.md
In this example lighthouse will "open url" and puppeteer will add a style tag. I wonder if this will have any effect on the lighthouse result itself. Two thoughts:
Probably this is not much of an issue regarding the example. But how about using puppeteers’s page.setContent(html[, options]) to e.g. test an optimized version of the html.
To give you more context I am looking for a way to intercept the HTML that is tested. I see that Chrome DevTools Protocol has Network.getResponseBodyForInterception but it is experimental and not supported by puppeteer.
Beta Was this translation helpful? Give feedback.
All reactions