Method to show if element is displayed
See original GitHub issueDoes Puppeteer has API which help detect if element is visible (or displayed), analogue to Selenium (Webdriver) .isDisplayed
method?
I found method waitForSelector method which has options visible
, but I think if DOM node has display: block;
and some parent component has style overflow: hidden
and my element outside the parent this waitForSelector
returns wrong
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Check if element is visible in DOM - javascript - Stack Overflow
If element is regular visible (display:block and visibillity:visible), but some parent container is hidden, ...
Read more >How does Selenium isDisplayed() method work | BrowserStack
The isDisplayed method in Selenium verifies if a certain element is present and displayed. If the element is displayed, then the value ...
Read more >Check If an Element is Visible in the Viewport in JavaScript
Use the getBoundingClientRect() method to get the size of the element and its relative position to the viewport. · Compare the position of...
Read more >How To Find Out if an Element is Hidden - W3Schools
To find out if an element is hidden with visibility:hidden , see the example below. This "hidden" element will take up space.
Read more >How to check if an element is hidden or visible using JavaScript
In JavaScript, the quickest way to check if an element is hidden or visible in DOM is to use the getComputedStyle() method.
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
Hi guys, I am getting bit lost in the various discussions and implementation efforts regarding visibility gong on here 😃
You was discussing the visibility in the viewport… I have slightly different problem.
I am trying to wait for the element which is present in the DOM, but is not visible from human point of view - it is overlaid by video.
Is there a way how to detect if the element is visible by human and clickable? Even if that would be temporary workaround.
If I am posting it into wrong ticket, sorry for that and feel free to correct me.
Thanks!
@ebidel nice idea, we should use Intersection Observer for the
waitForSelector
implementation.Not yet, but it makes perfect sense to have
ElementHandle.isVisible()
that is aligned withwaitForSelector
’s implementation of visibility.