question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Method to show if element is displayed

See original GitHub issue

Does 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:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
pavelbinarcommented, Feb 4, 2019

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!

2reactions
aslushnikovcommented, May 31, 2018

Using Intersection Observer would be more appropriate for this case.

@ebidel nice idea, we should use Intersection Observer for the waitForSelector implementation.

Does Puppeteer has API which help detect if element is visible (or displayed), analogue to Selenium (Webdriver) .isDisplayed method?

Not yet, but it makes perfect sense to have ElementHandle.isVisible() that is aligned with waitForSelector’s implementation of visibility.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found