w3c / w3c/webdriver

Wait for request animation frame after scrolling into view in element click/clear/send keys

Open
#1,944 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Element Clear Element Click Element Send Keys needs-discussion
Dominant language
HTML
Stars
718
Forks
228
PR merge metrics
No merged PRs in 30d

Description

All three commands of the interaction module involve performing a scroll into view in case the element we want to interact with is not in view.

However, even with behavior instant, the document handles scrolls in a queue, so there's no guarantee the scroll is synchronously executed, and that a corresponding scroll event is emitted in the page. If the test page has some logic attached as a listener to the "scroll" event which is necessary to make the element in view (eg changing the visibility of the element or its parent), then we would need to wait a bit after the scroll in order to perform the next is in view check.

This originally came from https://bugzilla.mozilla.org/show_bug.cgi?id=2014538, where the tested application uses a panel list widget which does react to the scroll event. Without waiting after the scroll, this application cannot use element click / clear / send keys to test their widget.

The current suggestion was to at least wait for the next animation frame. But we can have other strategies.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the WebDriver element interaction module and its scroll-into-view and in-view steps, then review the linked Mozilla bug for the triggering behavior. Determine and document an agreed waiting strategy, such as the next animation frame, and update the interaction algorithms so click, clear, and send keys consistently handle scroll-event-driven visibility changes.

Written by the indexing model from the issue text.

Assessment

Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.