-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[Question] Is it possible to scroll element into view until it's visible and can be clicked? #5052
Comments
Typically, click will scroll the element into view. But in your case, it seems like the overlay is still covering the item? You could page.evaluate(() => document.body.scrollTop = ...) or document.documentElement.scrollTop = ... manually, depending on where your scroll bar is. |
Right, the overlay is still covering the item. I can do the scroll manually but probably it will tend to break more easily if the UI or data changed. |
As per @dgozman, we should now be alternating scroll into view strategy in order to address your issue. Are you on the latest Playwright? |
See issue #3105. Should be fixed in Playwright v1.8.0. |
Yay! @nadavkaner, closing as per above, please feel free to open a new issue if it did not do the trick! |
I have a use case in which I have a side nav that is scrollable and there is a fixed overlay element (the black rectangle in the image) that can hide items that clickable in the side nav:
I'm trying in my test to click on the "Test 2" link but it's hidden by the overlay and I don't see a way to scroll it into view until it visible and can be clicked, I tried to use
scrollIntoViewIfNeeded
that doesn't work.Is there an existing API that can help in this case to scroll to the element until it visible and can be clicked?
Thanks!
The text was updated successfully, but these errors were encountered: