appium-windows-driver icon indicating copy to clipboard operation
appium-windows-driver copied to clipboard

DPI compatibility issue when try method in "execute_script"

Open pppppino opened this issue 11 months ago • 2 comments

When my windows DPI is 100%, I could rightClick success, while it failed when my windows DPI is 150%, it seems the "rightClick" action worked on the false (x, y)

my code: self.driver.execute_script('windows: click', {"elementId": self.wait_locator(loc).id, "button": "right"});

at the same time, I have tried other "execute_script" method, including: windows: scroll, windows: hover, "windows: click". All these method have this issue

DPI Setting: Setting > System > Display > Scale

pppppino avatar Jan 16 '25 09:01 pppppino

by the way, no matter what DPI, driver.findElement().click() could always click in the true place

pppppino avatar Jan 16 '25 09:01 pppppino

It is currently expected to not work with scaled screen.

This driver gets orientation info via WinAppDriver, so if it returns the scaled value, we can support it. But the WAD doesn't support it for now. https://github.com/appium/appium-windows-driver/blob/e4849fb2b42f1e3c04868a05a1ef3b807fee13c5/lib/commands/gestures.js#L87-L95

If you have an idea to get a proper coordinate programmatically, we could add such a calculation in this driver layer from the WAD response. Not the element id, but for example x/y addresses:

The screen scale (if customized) is not taken into consideration while calculating the coordinate.

https://github.com/appium/appium-windows-driver?tab=readme-ov-file#windows-click

KazuCocoa avatar Jan 17 '25 07:01 KazuCocoa