I want to input values in monkeyrunner,such as input username,password to login my application.but I don't know how to do it,I just only know how to touch and press. thanks for your help.
2 Answers
Using device.type("Username")
device.type("password")
You can input the values in monkeyrunner. Which letter do u want to type that string u can be give as a argument of type("string")
.
There are two ways to input values using monkeyrunner.
The first is to use the press
function of the MonkeyDevice class to send key event specified by type to the key specified by keycode (see http://developer.android.com/tools/help/MonkeyDevice.html#press). By this way, you can send all key events contained in Android.view.KeyEvent. For example, if you want to input the number key 8, you can use device.press('KEYCODE_8', 'DOWN_AND_UP')
.
However, if you just want to input strings such as a username or a password, it is convenient to use the type
function such as device.type("username")
.