What is the third argument to monkeyrunner.press

After upgrading the SDK to version 12, when I connect to monkeyrunner and use the push method, for example device.press ("KEYCODE_HOME", "DOWN") Will receive an msg error

Traceback (last last call): File "", line 1, in TypeError: click: the third argument is required.

But I will check sdk doc, which only presses two arguments. This is a problem caused by the new version SDK tool.

+5
source share
4 answers

To press a key with the monkey runner, you need to use something like device.press('KEYCODE_HOME',MonkeyDevice.DOWN_AND_UP), you do not need to add a third argument.

, , 'DOWN' MonkeyDevice.DOWN

+3

, . MonkeyDevice: DOWN, UP DOWN_AND_UP

MonkeyDevice, , , Monkeyrunner, 'down', 'up' 'downAndUp'.

enum ChimpChat.TouchPressType. :

public enum TouchPressType {
    DOWN("down"), UP("up"), DOWN_AND_UP("downAndUp");
...
}
+2

, - device.press('KEYCODE_HOME', 'DOWN', ''), .

.

+1

MonkeyDevice

For example, the paste command would look like this.

device.press('KEYCODE_PASTE',MonkeyDevice.DOWN)
0
source

All Articles