Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ElementHandle.isInViewport() #4423

Open
imiric opened this issue Aug 12, 2022 · 0 comments
Open

Add ElementHandle.isInViewport() #4423

imiric opened this issue Aug 12, 2022 · 0 comments

Comments

@imiric
Copy link
Contributor

imiric commented Aug 12, 2022

From this discussion in grafana/xk6-browser#467, we wanted to change TestWaitForFrameNavigationWithinDocument to also check whether an element is visible within the viewport after a navigation in the same document happens.

To do that it would be helpful if there was an ElementHandle.isInViewport() method, similar to the one described here. Playwright doesn't have such a method, but Puppeteer has ElementHandle.isIntersectingViewport(). isInViewport seems like a slightly better name, so let's go with that.

Suggested solution

We already have ElementHandle.boundingBox() in Go, though if we want to reduce the amount of JS evaluations and CDP calls, we could just wrap ElementHandle.eval() and do a single CDP call for this.

See #4424 for the test change to use this method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants