简体   繁体   中英

How to input values in monkeyrunner?

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.

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") .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM