Skip to content
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

page.screenshot clip not working correctly, fullPage is ok #5410

Closed
minzojian opened this issue Feb 11, 2020 · 7 comments
Closed

page.screenshot clip not working correctly, fullPage is ok #5410

minzojian opened this issue Feb 11, 2020 · 7 comments

Comments

@minzojian
Copy link

i have 2 pages content, and try to capture into 2 PNGs
image
when i set fullPage,it works fine
however, when i try to set clip:{x:0,y:1000,width:1000,height:1000} and going to capture the second page, i got a empty content. that's wired. even i try to set clip clip:{x:0,y:0,width:2000,height:2000} and going to capture a whole content area, i still got only the first page content, what happen?
image

@minzojian
Copy link
Author

same problem like this post #5300

@ibrahimalthomali
Copy link

I wounder if clipping is based on available image after screenshot is taken. So it may be the image is lets say 100x100 and you try to clip a region outside this region at X and Y > 100. While fullPage image is larger??? Not sure but i am guessing here.

I have an issue with fullPage changing the actual viewport size and therefore elements are not where expected. See my issue #5411. I wounder if you or anyone else found the same?

@caramdache
Copy link

I have the same issue, clip is not working. Unless I'm mistaken, the clip parameter is ignored by the screenshotCapture function:

clip = {x: 0, y: 0, width: deviceMetrics.width, height: deviceMetrics.height, scale: 1};

https://github.com/ChromeDevTools/devtools-frontend/blob/f5d825ac1bb6eca13782947e30e5c5c78b9de1f0/front_end/emulation/DeviceModeModel.js#L736

@luminous8
Copy link

I just updated from puppeteer 1.XX to puppeteer 5.00 and realised that the clip function doesn't work as before. It'll always take the viewport height unless we set the viewport height to the content height. But this doesn't work in some cases.

I've been using the clip function for at least 2 years and never got any issue. Now I can't update to the latests releases because of this.

Does someone found and alternative solution to take fullsize screenshot with the clip function?

@lpolito
Copy link

lpolito commented Sep 24, 2020

I just updated from puppeteer 1.XX to puppeteer 5.00 and realised that the clip function doesn't work as before.

Literally just made the same jump and having the same problem.

All of our automated screenshot tests took screenshots bound by a clip selector. Previously setting clip would allow screenshot to take an image of whatever was inside the bounds of clip, regardless of what the viewport was set to. If a portion of the clip was outside of the viewport, the screenshot was still complete.

Now it looks like the viewport size is limiting what the screenshot can take, even if a clip is specified.

To get around this, we set an arbitrarily high defaultViewport height (in my case 10000px just to be safe) so that any screenshot we take aren't affected by the viewport size. I hope this helps anyone else having the same issue.

edit: And realizing now this doesn't fix all cases, of course, but it's workable.

@stale
Copy link

stale bot commented Jun 25, 2022

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.

@stale stale bot added the unconfirmed label Jun 25, 2022
@stale
Copy link

stale bot commented Jul 26, 2022

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!

@stale stale bot closed this as completed Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants