How can I check with Puppeteer whether an HTML element is visible within the viewport (the visible area) or not? For example if I have to scroll to be able to see a button, then it's not visible.
page.waitForSelector('#element', { visible: true })
The page.waitForSelector function is not what I'm looking for, because it only checks if the element is in the DOM and is not hidden with CSS properties.
Is there any method to check an element's visibility in the viewport?