i want to simulate long press on power key using AndroidViewClient , i could achieve this using monkeyrunner . code is as follows :
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
device = MonkeyRunner.waitForConnection(10,'840615d')
device.press("KEYCODE_POWER", MonkeyDevice.DOWN)
please help ...
Android API - kitkat (19)
AndroidViewClient version - 5.5.1
The latest version (AndroidViewClient 6.0.0) provides a new (an experimental) AdbClient.longPress(name)
method, which has an special workaround for the POWER
case as it seems input keyevent --longpress POWER
does not work as expected.
You can try:
device.longPress('POWER')
and see if it works. If it does not, please read the comments in that method and follow the instruction to create a bug report that could add support for your device too.