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

session.moveTo(element:) does not move mouse to the element for app caption buttons #39

Open
stevenbrix opened this issue Jul 26, 2023 · 8 comments

Comments

@stevenbrix
Copy link
Contributor

I found that doing something like this in an app:

 let closeButton = session.findElement(byName: "Close")
 session.moveTo(element:closeButton!)

will not actually move the mouse to the element

@tristanlabelle
Copy link
Contributor

Here's what the doc has to say. It's a pretty confusing API but I think your call should work:

POST /session/:sessionId/moveto
Move the mouse by an offset of the specificed element. If no element is specified, the move is relative to the current mouse cursor. If an element is provided but no offset, the mouse will be moved to the center of the element. If the element is not visible, it will be scrolled into view.

@jeffdav
Copy link
Contributor

jeffdav commented Aug 1, 2023

@stevenbrix -- Does findElement find the close button? If you push a branch or send a patch I can debug this.

@jeffdav
Copy link
Contributor

jeffdav commented Aug 8, 2023

Was this the DPI issue?

@tristanlabelle
Copy link
Contributor

My new tests from #89 use moveTo with an element successfully. One thing to be aware is that by default it moves to the top-left of the element's bounding box, which might not be a clickable pixel. In my test, I had to offset it by a few pixels to be in the clickable area.

Closing this until further info.

@stevenbrix stevenbrix reopened this Dec 21, 2023
@stevenbrix stevenbrix changed the title session.moveTo(element:) does not move mouse to the element session.moveTo(element:) does not move mouse to the element for app caption buttons Dec 21, 2023
@stevenbrix
Copy link
Contributor Author

this isn't fixed, there must be something special about the caption buttons as this works for normal elements. i updated the title accordingly

@tristanlabelle
Copy link
Contributor

tristanlabelle commented Dec 21, 2023

this isn't fixed, there must be something special about the caption buttons as this works for normal elements. i updated the title accordingly

@stevenbrix , in that case it might not be fixable in swift-webdriver. It would be worthwhile filing a bug on WinAppDriver itself: https://github.com/microsoft/WinAppDriver . Can we work around the issue at the application level?

@stevenbrix
Copy link
Contributor Author

unfortunately not really, we can send WM_CLOSE but that doesn't simulate an end-user interaction

@jeffdav
Copy link
Contributor

jeffdav commented Jul 31, 2024

What about sending ALT+F4?

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

No branches or pull requests

3 participants