webdriver
webdriver copied to clipboard
Scrolling option `block: end` should be `block: center`
To scroll into view an element perform the following steps only if the element is not already in view:
Let options be the following ScrollIntoViewOptions:
Logical scroll position "block" "end" Logical scroll position "inline" "nearest"
In case the element is bigger than the scrollable element, the element center to be clicked does not get scrolled into the view.
data:text/html;charset=utf-8,<div` style="height: 200px; overflow: scroll;"><div id="a" onclick="alert(JSON.stringify('y: ' + (this.parentNode.scrollTop + event.clientY)))" style="background: linear-gradient(0deg, rgba(255,0,0,1) 0%, rgba(255,0,0,1) 48%, rgba(0,255,0,1) 50%, rgba(255,0,0,1) 52%, rgba(255,0,0,1) 100%); width: 800px; height: 1000px;"></div></div>
This is a data url showing a green line in the center of the element, as soon as the element is clicked the element must be scrolled in to view. The element should be clicked at its center, so i would expect the UI in this state:
But the element is scolled to the lower end, as specified by the spec and then clicked:
The alert does show the coordinates clicked, which are also not the correct ones.
The webdriver does click the center of the visible part, which should be correct when the element is scrolled into view using block: center.