We're using webdriverio to execute automated tests on Safari. The w3c command "scrollIntoView" causes the following command to return wrong coordinates: /session/:sessionId/element/:elementId/rect": { "GET": { "command": "getElementRect", "description": "The Get Element Rect command returns the dimensions and coordinates of the given web element.", "ref": "https://w3c.github.io/webdriver/#dfn-get-element-rect", "variables": [{ "name": "elementId", "description": "the id of an element returned in a previous call to Find Element(s)" }], "parameters": [], "returns": { "type": "Object", "name": "elementRect", "description": "A JSON object representing the position and bounding rect of the element." } } }, The returned values are off by the amount of scroll range. According to the w3c specification "rect" should return coordinates relative to the browsing context and not to the viewport.
reference: https://feedbackassistant.apple.com/feedback/9381783
rdar://80958449 > According to the w3c specification "rect" should return coordinates relative to the browsing context No, it's "relative to the current browsing context’s document element" WPT has some failing tests, though not scrolling first: https://wpt.fyi/results/webdriver/tests/get_element_rect/get.py?label=experimental&label=master&aligned