Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MoveTo docs regarding origin for offsets #324

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

derat
Copy link

@derat derat commented Apr 21, 2024

WebElement.MoveTo's documentation stated that the supplied offsets are interpreted relative to the element's center, but this seems to be incorrect. Since remoteWE's implementation always passes "xoffset" and "yoffset" parameters, the offsets are interpreted relative to the element's top-left corner.


The spec states that the mouse is moved to the center of the element if no offsets are supplied, but that offsets are interpreted relative to the top-left corner of the element.

Here's the implementation, which unconditionally passes offsets:

selenium/remote.go

Lines 1415 to 1421 in e9100b7

func (elem *remoteWE) MoveTo(xOffset, yOffset int) error {
return elem.parent.voidCommand("/session/%s/moveto", map[string]interface{}{
"element": elem.id,
"xoffset": xOffset,
"yoffset": yOffset,
})
}

See also #190.

WebElement.MoveTo's documentation stated that the supplied
offsets are interpreted relative to the element's center,
but this seems to be incorrect. Since remoteWE's
implementation always passes "xoffset" and "yoffset"
parameters, the offsets are interpreted relative to the
element's top-left corner.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant