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

[Help]Windows MoveTo element is not working #283

Open
yi-122 opened this issue Nov 18, 2024 · 1 comment
Open

[Help]Windows MoveTo element is not working #283

yi-122 opened this issue Nov 18, 2024 · 1 comment

Comments

@yi-122
Copy link

yi-122 commented Nov 18, 2024

Environment

  • Appium version : 2.12.1
  • Desktop version used to run Appium: Windows 10
  • Windows Application Driver: 1.2.1
  • Dart package appium_driver: 0.7.1

Detail

I attempted to perform automated testing on the Windows 10 calculator software, and I encountered an error when trying to use the moveTo method from w3c/mouse.dart to move the mouse to a specified location.

The code is as follows:

driver.mouse.moveTo(element: element)

The error message is as follows:

{value: {error: invalid argument, message: 值不能为 null。 参数名: value, stacktrace: InvalidArgumentError: 值不能为 null。 参数名: value at errorFromW3CJsonCode (C:\Users\Administrator\AppData\Roaming\nvm\v22.3.0\node_modules\appium\node_modules\@appium\base-driver\lib\protocol\errors.js:1112:25) at ProxyRequestError.getActualError (C:\Users\Administrator\AppData\Roaming\nvm\v22.3.0\node_modules\appium\node_modules\@appium\base-driver\lib\protocol\errors.js:981:14) at WADProxy.proxyReqRes (C:\Users\Administrator\AppData\Roaming\nvm\v22.3.0\node_modules\appium\node_modules\@appium\base-driver\lib\jsonwp-proxy\proxy.js:410:58) at processTicksAndRejections (node:internal/process/task_queues:95:5)}}

Appium server log is as follows:

[7a3b8c3e][HTTP] --> POST /session/7a3b8c3e-0625-4d5f-814a-e8c3e5666634/actions {"actions":[{"type":"pointer","id":"mouses","actions":[{"type":"pointerMove","origin":{"element-6066-11e4-a52e-4f735466cecf":"42.5703722.4.66"},"x":0,"y":0}]}]}
[7a3b8c3e][WindowsDriver@a069] Driver proxy active, passing request on via HTTP proxy
[7a3b8c3e][WindowsDriver@a069] Matched '/session/7a3b8c3e-0625-4d5f-814a-e8c3e5666634/actions' to command name 'performActions'
[7a3b8c3e][WindowsDriver@a069] Proxying [POST /session/7a3b8c3e-0625-4d5f-814a-e8c3e5666634/actions] to [POST http://127.0.0.1:4724/wd/hub/session/3233F4FF-908D-4FD4-884A-C08AE14398CA/actions] with body: {"actions":[{"type":"pointer","id":"mouses","actions":[{"type":"pointerMove","origin":{"ELEMENT":"42.5703722.4.66","element-6066-11e4-a52e-4f735466cecf":"42.5703722.4.66"},"x":0,"y":0}]}]}
[7a3b8c3e][WindowsDriver@a069] ==========================================
POST /wd/hub/session/3233F4FF-908D-4FD4-884A-C08AE14398CA/actions HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, compress, deflate, br
Connection: keep-alive
Content-Length: 188
Content-Type: application/json; charset=utf-8
Host: 127.0.0.1:4724
User-Agent: appium

{"actions":[{"type":"pointer","id":"mouses","actions":[{"type":"pointerMove","origin":{"ELEMENT":"42.5703722.4.66","element-6066-11e4-a52e-4f735466cecf":"42.5703722.4.66"},"x":0,"y":0}]}]}
[7a3b8c3e][WindowsDriver@a069] HTTP/1.1 400 Bad Request
Content-Length: 104
Content-Type: application/json

{"status":100,"value":{"error":"invalid argument","message":"值不能为 null。\r\n参数名: value"}}
[7a3b8c3e][WindowsDriver@a069] Got response with status 400: {"status":100,"value":{"error":"invalid argument","message":"值不能为 null。\r\n参数名: value"}}
[7a3b8c3e][W3C] Matched W3C error code 'invalid argument' to InvalidArgumentError
[7a3b8c3e][HTTP] <-- POST /session/7a3b8c3e-0625-4d5f-814a-e8c3e5666634/actions 400 103 ms - 728

Thers is same problem when I try to use mouseUp/mouseDown method. How can I solve this problem?

Thanks.
😱

@mykola-mokhnach
Copy link

WinAppDriver does not support W3C mouse actions.
Consider using either deprecated touchactions (see for example https://github.com/microsoft/WinAppDriver/blob/master/Tests/WebDriverAPI/TouchDownMoveUp.cs)

or the corresponding extensions, for example https://github.com/appium/appium-windows-driver?tab=readme-ov-file#windows-hover

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

2 participants