openatx / uiautomator2

Android Uiautomator2 Python Wrapper
MIT License
6.18k stars 1.35k forks source link

can't click edge of screen... d.info['displayHeight'] SMALLER than d.device_info['display']['height'] #226

Closed gamesguru closed 1 month ago

gamesguru commented 5 years ago

See the difference here

>>> d.info
{'currentPackageName': 'com.lci1.one', 'displayHeight': 552, 'displayRotation': 0, '
displaySizeDpX': 1024, 'displaySizeDpY': 600, 'displayWidth': 1024, 'productName': '
astar_d7', 'screenOn': True, 'sdkInt': 23, 'naturalOrientation': True}

displayHeight': 552

>>> d.device_info
{'udid': '873c1c8826f700000000--OCTP_7', 'version': '6.0.1', 'serial': '873c1c8826f7
00000000', 'brand': 'Allwinner', 'model': 'OCTP_7', 'sdk': 23, 'agentVersion': '0.4.
3', 'display': {'width': 1024, 'height': 600}, 'battery': {'acPowered': True, 'usbPo
wered': True, 'wirelessPowered': False, 'status': 5, 'health': 0, 'present': False, 
'level': 100, 'scale': 100, 'voltage': 0, 'temperature': 300, 'technology': 'LiFe'},
 'memory': {'total': 1026932, 'around': '1 GB'}, 'cpu': {'cores': 4, 'hardware': 'su
n8i'}, 'presenceChangedAt': '0001-01-01T00:00:00Z', 'usingBeganAt': '0001-01-01T00:0
0:00Z'}

'height': 600

And when I try this, it is NOT working

>>> d.tap(131,569)

This does!! But it's much slower and unconventional, so I am requesting a fix

d.adb_shell('input tap 131 569')
gamesguru commented 5 years ago

anyone facing this issue in the meantime can take the following steps as a workaround while we get to the bottom of things,

1) When invoking u2.tap(x, y) do a quick int comparison between x and y 2) if either exceeds the bounds of the displayArea (x>d.x or y>d.y), use u2.adb_shell('input tap x y') instead

if displayArea is not exceeded (majority of the time) tap will happen quickly, if it is, tap will happen a little more slowly over adb shell but at least it will still happen

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.