microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.42k stars 3.63k forks source link

[Bug]: ScrollIntoViewIfNeededAsync() implementation for dotnet does unexpected actionability check breaking its operation #29307

Closed vkudley closed 8 months ago

vkudley commented 8 months ago

Version

1.41.2

Steps to reproduce

Dotnet code, explicit use: await element.ScrollIntoViewIfNeededAsync();

Expected behavior

I expect an element to be scrolled into a view to become Visible after checking that it is Stable

Actual behavior

System.TimeoutException: Timeout 29999.977ms exceeded.

Call log:

Additional context

According to https://playwright.dev/dotnet/docs/actionability this method should only check for Stable and ignore Visible, which makes sense for elements that need to be scrolled into view. Somehow it makes unnecessary check for Visible and times out

Environment

System:
    OS: Windows 10 10.0.19045
    Memory: 15.46 GB / 31.61 GB
  Binaries:
    Node: 20.9.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.2.1 - C:\Program Files\nodejs\npm.CMD
  Languages:
    Bash: 5.1.16 - C:\WINDOWS\system32\bash.EXE
pavelfeldman commented 8 months ago

Playwright allows scrolling element into view only if it has a layout object (display is not none). When element has display: none, browser does not know where to scroll to. We need to update our docs and require visibility on scrolling to avoid this ambiguity.

vkudley commented 8 months ago

Thanks for the prompt and actionable reply! There is no explicit Displayed column in actionability table and I confused it with Visible. Actual problem was with Locator pointing at the match in a wrong section of the DOM while I was looking at the "correct" one.