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
Fullpage Screenshot Problem with some Single Page Websites #959
Comments
+1 I encounter same bug on mobile version of a website, in a ubuntu environnement. |
Seems they have lazy load image. |
Scrolling with some wait time didn't solve the issue? |
For now, I solved my problem with image lazy load by set page viewport height as max as possible. await page.setViewport({
width: 1440,
height: 10000 // set whatever you want
}) |
Scrolling with wait time and declare the height of the viewport to a large number does not solve the problem with some pages, e.g. http://thehenhouse.com.au/ |
Use something like urlbox.io? Handles full-height backgrounds ok in full screen mode. https://api.urlbox.io/v1/ca482d7e-9417-4569-90fe-80f7c5e1c781/f1dec2f00eee0b46452e2519b48c660a36d09eb9/png?url=http%3A%2F%2Fthehenhouse.com.au%2F&full_page=true |
@cjroebuck this is not a solution as some of us may be trying to create services similar to urlbox.io using puppeteer. |
I believe the problem here is that Puppeteer is naively increasing the client height. This is not the same as making an actual screenshot of content below the fold (scrollbar), because content dynamically adjusts based on the client height (e.g. if you use Therefore we need an actual "screenshot content below the fold" feature, rather than a hack that is simply making the screen size larger temporarily. |
+1 same issue on https://evo.ca |
add this code before screenshot to fix:
|
This works for some cases. I'm still getting long pages. By the way, instagram.com is one of them! |
using last version of puppeteer (version 8.0.0) seems to work. const puppeteer = require('puppeteer');
const height = 720, width = height * 16 / 9;
const url = 'https://thehenhouse.com.au/';
const options = {
args: [
'--window-size=' + width + ',' + height,
],
devtools: false,
headless: true,
defaultViewport: null,
};
const browser = await puppeteer.launch(options);
const page = await browser.newPage();
await page.goto(url);
await page.screenshot({
path: 'example.png',
fullPage: true
}); example in replit |
I tried with puppeteer 8.0.0 and it works. Wondering if I can get the AWS lambda layer for Puppeteer 8.0.0? |
We're marking this issue as unconfirmed because it has not had recent activity and we weren't able to confirm it yet. It will be closed if no further activity occurs within the next 30 days. |
We are closing this issue. If the issue still persists in the latest version of Puppeteer, please reopen the issue and update the description. We will try our best to accomodate it! |
Tell us about your environment:
Problem?
Fullpage screenshots of single page websites will not be displayed correctly.
I tried to clip areas, scrolling through the page and waitForNavigation.
Similiar problems with navalia, chromeless and phantomjs.
Is there anything else i can do?
Steps reproduce
`const puppeteer = require('puppeteer');
var url = "http://thehenhouse.com.au/"; // page url
var name = "the"
var resWidth = 1366; // width of screenshot
var resHeight = 1000;
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage()
await page.goto(url, {waitUntil: 'load'});
// await page.waitForNavigation({waitUntil: 'networkidle'});
await page.setViewport({width: resWidth, height: resHeight});
await page.emulateMedia('screen');
await page.screenshot({path: name + '-' + resWidth + '.jpeg', type: 'jpeg', fullPage: true});
console.log("screenshot done");
await browser.close();
})();`
The text was updated successfully, but these errors were encountered: