How does Playwright manage interactions with elements outside the viewport?

In our insightful Ask Me Anything session with @utchbe on Playwright, an interesting question was brought up by Ella V:

"We have custom scroll logic that works well manually, but in Cypress, it causes elements to scroll under others, making them hidden. Weโ€™ve used {scrollBehaviour: false} in Cypress for this.

  1. Is there an equivalent in Playwright? (My search suggests no)
  2. Can you provide an example of how to click on an element outside of the viewport in Playwright?"

This question highlights a common challenge in test automation. If anyone has tackled similar issues or knows about handling scrolling and viewport interactions in Playwright, your insights would be greatly appreciated.


The specific questions, like this one, should have the code attached and ideally the app as well, so that it is easier to understand what this means.

Playwright also has a git repository where people can post issues. They have a couple of technical support people who reply, or maybe a fellow engineer has had this problem as well: Issues ยท microsoft/playwright ยท GitHub

Additionally, whatโ€™s the scope of the implemented check? to access elements, to view things lower in the list, to analyze the behavior of the custom scrolling?

What happens if you donโ€™t automate that one, or any other customized things that are not adhering to w3 standards?