Appium + python - input operational example

OS Import 
Import Time T AS

the adb = 'INPUT TAP 400 the adb the shell 500'
the os.system (the adb)

t.sleep (. 5)

class KeyEvent ():
"" "common event KeyEvent" ""
KEYCODE_HOME =. 3 #home key
KEYCODE_BACK = 4 #back key
KEYCODE_POWER = 26 # power key
KEYCODE_MENU = 82 # Main Menu key
KEYCODE_NOTIFICATION = 83 # lock screen button
KEYCODE_DPAD_UP = 19 # upwardly
KEYCODE_DPAD_DOWN = 20 # downwardly
KEYCODE_DPAD_LEFT = 21 # leftward
KEYCODE_DPAD_RIGHT = 22 # rightward

def adbkeyevent (KeyName = keyevent.KEYCODE_BACK):
"" "adb keyevent execution event, which is associated parameters from the class KeyEvent" ""
adb1 = 'INPUT KeyEvent the adb the shell S%'% KeyName
OS.system(adb1)

if __name__ == '__main__':
# Key operation performed back
adbkeyevent (keyevent.KEYCODE_BACK)


# Note: not in Chinese input, such as: Shanghai

adb2 = 'INPUT text the adb the shell 1234'
the os.system (adb2)

Guess you like

Origin www.cnblogs.com/Teachertao/p/10990932.html