Lazy images not loading beforprint
swamidass opened this issue · 1 comments
swamidass commented
This seems to be an issue with puppeteer, which needs to know that each image is in view before loading them. Is there an option to fix this?
This code might be a drop in fix...
// Scroll one viewport at a time, pausing to let content load
const viewportHeight = page.viewport().height;
let viewportIncr = 0;
while (viewportIncr + viewportHeight < height) {
await page.evaluate(_viewportHeight => {
window.scrollBy(0, _viewportHeight);
}, viewportHeight);
await wait(20);
viewportIncr = viewportIncr + viewportHeight;
}
https://gist.github.com/schnerd/b550b7c05d4a57d8374082aaae714881