appium / appium

Cross-platform automation framework for all kinds of apps, built on top of the W3C WebDriver protocol
http://appium.io/
Apache License 2.0
18.78k stars 6.07k forks source link

Appium reporting resolution size for Pixel4(Android) and viewport size for iPhoneXS(apple), how to choose absolute pixel location ? #18774

Closed vnuta9 closed 1 year ago

vnuta9 commented 1 year ago

I have some 10 method calls in my appium(ver2.0.0-beta71) QA testing code with absolute pixel measurements, which I have to correct by translating them to screen size percentage terms. I queries using Java-Client 8.5.1 for window size=driver.manage().window().getSize() which returned

As I also read that resolution is physical pixel count, and viewport is software pixel count.

But why I am getting physical pixel count for Pixel4 Android phone and viewport pixel count for iPhone ?? How to reconcile this and convert in to window size percentages ?

mykola-mokhnach commented 1 year ago

This is strictly related to how Google UiAutomator and Apple XCTest frameworks are designed.

The first one uses physical pixels which are counted in absolute coordinates (top left corner of the screen is [0,0]). It is also known to only return coordinates of the area which is actually intractable and can accept automated gestures. That is why the bottom bar containing navigation controls is usually excluded from these metrics.

The second one uses coordinates for each application window measured in logical pixels (top left corner of app window is [0,0]). Also, I don't think there is any way in iOS to know the absolute position of your application window (correct me someone if I'm wrong).