ElementHandle screenshot doesn't work properly when the element is offscreen
See original GitHub issueTell us about your environment:
- Puppeteer version: 5.3.0
- Platform / OS version: Fedora 32
- Node.js version: 12.18.3
What steps will reproduce the problem?
let’s say we have a page where there are “card” divs
<div class="card">blah blah</div>
<div class="card">blah blah blah</div>
const cards = await page.$$("div.card");
for (const [idx, card] of cards.entries()) {
await card.screenshot({
path: `pnl${idx}.png`
});
}
specifically, this happens on ftx.com/shareable-pnl, like this: element 1 element 2, wrong
What is the expected result? proper screenshots
What happens instead? the screenshot for the first card will come out fine, the second one comes incorrectly cropped from halfway to the bottom plus
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6
Top Results From Across the Web
Puppeteer in NodeJS reports 'Error: Node is either not visible ...
I'm using 'puppeteer' for NodeJS to test a specific website. It seems to work fine in most ...
Read more >Is there a way to do 'print screen' capturing areas off screen?
Here's another one that installs locally: Fireshot. It works for Firefox and IE. Here's a sample screenshot of SuperUser, click for hi-res:.
Read more >ElementHandle.screenshot() method - Puppeteer
ElementHandle.screenshot() method. This method scrolls element into view if needed, and then uses Page.screenshot() to take a screenshot of the element.
Read more >.scrollIntoView() | TestController | Test API | API | Docs
When TestCafe interacts with an off-screen DOM element, it scrolls that element into view. ... target, Function | String | Selector | Snapshot...
Read more >Puppeteer screenshot element, page or area - Pocket Admin
To take in puppeteer screenshot element you must run ElementHandle.screenshot(). Examples of how to take screenshot in puppeteer page, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@mikelpr Yep. Unfortunately, you will have to downgrade a lot. This happened when 2.0.0 was released. Here is the feedback issue for that specific change: https://github.com/puppeteer/puppeteer/issues/5080 I asked yesterday if there was a workaround yet and it seems that they have been talking about it recently: https://bugs.chromium.org/p/chromium/issues/detail?id=1003629#c11
So give it a try with https://github.com/puppeteer/puppeteer/releases/tag/v1.20.0 and if that solves your problem, then it means that your issue is indeed related to this change. But I’m like 95% sure that this is your problem.
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!