appium / appium-windows-driver

Appium's interface to WindowsAppDriver provided by Microsoft
Apache License 2.0
131 stars 35 forks source link

“windows: click” is working with "x" and "y", but not working with "elementId" #183

Closed pppppino closed 1 year ago

pppppino commented 1 year ago

Env:

Appium server: 2.0.0
Windows driver: 2.9.1
Appium-Python-Client: 2.11.1

When I tried: self.driver.execute_script('windows: click', {"x": ele.location["x"], "y": ele.location["y"], "times": 2}) It works, and I achieve "double-click"

But when I tried:: self.driver.execute_script('windows: click', {"elementId": ele.id, "times": 2}) I got an Exception: selenium.common.exceptions.InvalidArgumentException: Message: Either relative or absolute move coordinates must be provided

Server Log: [debug] [WindowsDriver@6183 (6db0c19a)] Responding to client with driver.getElementRect() result: {"x":341,"y":190,"width":357,"height":51} [HTTP] <-- GET /session/6db0c19a-04f9-4a41-b88c-58a7c8050689/element/3658197e-5990-430d-9691-f6980cbdc01a/rect 200 73 ms - 51 [HTTP] [HTTP] --> POST /session/6db0c19a-04f9-4a41-b88c-58a7c8050689/execute/sync [HTTP] {"script":"windows: click","args":[{"elementId":"3658197e-5990-430d-9691-f6980cbdc01a","times":2}]} [debug] [WindowsDriver@6183 (6db0c19a)] Calling AppiumDriver.execute() with args: ["windows: click",[{"elementId":"3658197e-5990-430d-9691-f6980cbdc01a","times":2}],"6db0c19a-04f9-4a41-b88c-58a7c8050689"] [WindowsDriver@6183 (6db0c19a)] Executing extension command 'windows: click' [debug] [WindowsDriver@6183 (6db0c19a)] Matched '/element/3658197e-5990-430d-9691-f6980cbdc01a/location' to command name 'getLocation' [debug] [WindowsDriver@6183 (6db0c19a)] Proxying [GET /element/3658197e-5990-430d-9691-f6980cbdc01a/location] to [GET http://127.0.0.1:4724/wd/hub/session/C226AB51-8275-47E6-9A78-6937DA9A7AA1/element/3658197e-5990-430d-9691-f6980cbdc01a/location] with no body [debug] [WindowsDriver@6183 (6db0c19a)] ========================================== [debug] [WindowsDriver@6183 (6db0c19a)] GET /wd/hub/session/C226AB51-8275-47E6-9A78-6937DA9A7AA1/element/3658197e-5990-430d-9691-f6980cbdc01a/location HTTP/1.1 [debug] [WindowsDriver@6183 (6db0c19a)] Accept: application/json, / [debug] [WindowsDriver@6183 (6db0c19a)] Accept-Encoding: gzip, compress, deflate, br [debug] [WindowsDriver@6183 (6db0c19a)] Connection: keep-alive [debug] [WindowsDriver@6183 (6db0c19a)] Content-Type: application/json; charset=utf-8 [debug] [WindowsDriver@6183 (6db0c19a)] Host: 127.0.0.1:4724 [debug] [WindowsDriver@6183 (6db0c19a)] User-Agent: appium [debug] [WindowsDriver@6183 (6db0c19a)] Got response with status 200: {"sessionId":"C226AB51-8275-47E6-9A78-6937DA9A7AA1","status":0,"value":{"x":341,"y":190}} [debug] [WindowsDriver@6183 (6db0c19a)] Matched '/element/3658197e-5990-430d-9691-f6980cbdc01a/size' to command name 'getSize' [debug] [WindowsDriver@6183 (6db0c19a)] Proxying [GET /element/3658197e-5990-430d-9691-f6980cbdc01a/size] to [GET http://127.0.0.1:4724/wd/hub/session/C226AB51-8275-47E6-9A78-6937DA9A7AA1/element/3658197e-5990-430d-9691-f6980cbdc01a/size] with no body [debug] [WindowsDriver@6183 (6db0c19a)] HTTP/1.1 200 OK [debug] [WindowsDriver@6183 (6db0c19a)] Content-Length: 89 [debug] [WindowsDriver@6183 (6db0c19a)] Content-Type: application/json [debug] [WindowsDriver@6183 (6db0c19a)] [debug] [WindowsDriver@6183 (6db0c19a)] {"sessionId":"C226AB51-8275-47E6-9A78-6937DA9A7AA1","status":0,"value":{"x":341,"y":190}} [debug] [WindowsDriver@6183 (6db0c19a)] Got response with status 200: {"sessionId":"C226AB51-8275-47E6-9A78-6937DA9A7AA1","status":0,"value":{"height":51,"width":357}} [debug] [WindowsDriver@6183 (6db0c19a)] Absolute coordinates: (519.5, 215.5) [debug] [WindowsDriver@6183 (6db0c19a)] ========================================== [debug] [WindowsDriver@6183 (6db0c19a)] GET /wd/hub/session/C226AB51-8275-47E6-9A78-6937DA9A7AA1/element/3658197e-5990-430d-9691-f6980cbdc01a/size HTTP/1.1 [debug] [WindowsDriver@6183 (6db0c19a)] Accept: application/json, / [debug] [WindowsDriver@6183 (6db0c19a)] Accept-Encoding: gzip, compress, deflate, br [debug] [WindowsDriver@6183 (6db0c19a)] Connection: keep-alive [debug] [WindowsDriver@6183 (6db0c19a)] Content-Type: application/json; charset=utf-8 [debug] [WindowsDriver@6183 (6db0c19a)] Host: 127.0.0.1:4724 [debug] [WindowsDriver@6183 (6db0c19a)] User-Agent: appium [debug] [WindowsDriver@6183 (6db0c19a)] [debug] [WindowsDriver@6183 (6db0c19a)] [debug] [WindowsDriver@6183 (6db0c19a)] HTTP/1.1 200 OK [debug] [WindowsDriver@6183 (6db0c19a)] Content-Length: 97 [debug] [WindowsDriver@6183 (6db0c19a)] Content-Type: application/json [debug] [WindowsDriver@6183 (6db0c19a)] [debug] [WindowsDriver@6183 (6db0c19a)] {"sessionId":"C226AB51-8275-47E6-9A78-6937DA9A7AA1","status":0,"value":{"height":51,"width":357}} [debug] [WindowsDriver@6183 (6db0c19a)] Encountered internal error running command: Error: Either relative or absolute move coordinates must be provided [debug] [WindowsDriver@6183 (6db0c19a)] at createInvalidArgumentError (C:\Users\admin.appium\node_modules\appium-windows-driver\lib\commands\winapi\errors.js:6:15) [debug] [WindowsDriver@6183 (6db0c19a)] at toMouseMoveInput (C:\Users\admin.appium\node_modules\appium-windows-driver\lib\commands\winapi\user32.js:320:37) [debug] [WindowsDriver@6183 (6db0c19a)] at WindowsDriver.windowsClick (C:\Users\admin.appium\node_modules\appium-windows-driver\lib\commands\gestures.js:306:23) [debug] [WindowsDriver@6183 (6db0c19a)] at processTicksAndRejections (node:internal/process/task_queues:95:5) [debug] [WindowsDriver@6183 (6db0c19a)] at WindowsDriver.executeWindowsCommand (C:\Users\admin.appium\node_modules\appium-windows-driver\lib\commands\execute.js:43:10) [debug] [WindowsDriver@6183 (6db0c19a)] at WindowsDriver.execute (C:\Users\admin.appium\node_modules\appium-windows-driver\lib\commands\execute.js:30:12) [HTTP] <-- POST /session/6db0c19a-04f9-4a41-b88c-58a7c8050689/execute/sync 400 105 ms - 946 [HTTP] [HTTP] --> GET /session/6db0c19a-04f9-4a41-b88c-58a7c8050689/screenshot [HTTP] {} [debug] [WindowsDriver@6183 (6db0c19a)] Calling AppiumDriver.getScreenshot() with args: ["6db0c19a-04f9-4a41-b88c-58a7c8050689"] [debug] [WindowsDriver@6183 (6db0c19a)] Matched '/screenshot' to command name 'getScreenshot' [debug] [WindowsDriver@6183 (6db0c19a)] Proxying [GET /screenshot] to [GET http://127.0.0.1:4724/wd/hub/session/C226AB51-8275-47E6-9A78-6937DA9A7AA1/screenshot] with no body [debug] [WindowsDriver@6183 (6db0c19a)] ==========================================

mykola-mokhnach commented 1 year ago

Update the driver to the latest version

pppppino commented 1 year ago

@mykola-mokhnach latest version is OK, thanks, also hopping for a perfect version.