blank screenshot of element at the bottom of page
See original GitHub issueSteps to reproduce
Tell us about your environment:
- Puppeteer version: 1.14.0
- Platform / OS version: centos(docker) / macOS
- URLs (if applicable): null
- Node.js version: 12.2.0
What steps will reproduce the problem?
.footer
is the last element of a long page. I got an blank image.
I got the correct screenshot in more than one way:
- Moved it forward
- Set viewport height bigger than the content height.
<body>
<div class="J_container" style="width: 1050px; margin: 0 auto;">
<div class="header">...</div>
<div class="report_main">...</div>
<div class="footer" style="height: 300px; background: url(/static/images/footer.png) no-repeat center; ...other-style"></div>
</div>
</body>
const browser = await puppeteer.launch({
args: [
'--no-sandbox',
'--enable-font-antialiasing',
'--disable-dev-shm-usage'
]
})
const page = await browser.newPage()
await page.setViewport({
width: 1920,
height: 100,
deviceScaleFactor: 1
})
await page.goto('http://www.example.com', { waitUntil: ['load', 'networkidle0'] })
const selectors = ['.footer']
const base64Datas = []
while (selectors.length) {
const selector = selectors.shift()
const element = await page.$(selector)
if (!element) {
base64Datas.push(null)
continue
}
const base64Data = await element.screenshot({ encoding: 'base64' })
base64Datas.push(base64Data)
}
What is the expected result?
Got correct screenshot.
What happens instead?
Got an blank image.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
blank screenshot of element at the bottom of page · Issue #4497
I got the correct screenshot in more than one way: Moved it forward; Set viewport height bigger than the content height. ... What...
Read more >html2canvas taking screenshot of DOM element showing blank
I'm trying to take a screenshot of an element on my page using html2pdf and append it above that element, but it's showing...
Read more >How to capture/take Selenium Screenshot as Full ... - Tools QA
For particular elements, we can either take the full page screenshot and then crop the image. If we are using Selenium 4.X, we...
Read more >How to Take a Full-Page Screenshot - Zapier
Just type "screenshot" and you'll see the option appear to "capture full size screenshot." Simply select this and Chrome will automatically ...
Read more >How to take screenshot of a div using JavaScript
The below steps show the method to take a screenshot of a <div> element using JavaScript. Step 1: Create a blank HTML document....
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 FreeTop 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
Top GitHub Comments
@Manjiz No, it’s possible to get multi-factor income with your code.
Still this is a very specific solution, like I have to change my code every now and then if I change the website url. What if I just want to keep scrolling and taking screenshots and in the last part I will clip the required part by calculating the remaining height of the website to be scrolled.