@@ -0,0 +1,2226 @@
+#! /usr/bin/monkeyrunner%0A'''%0A____________________________________________________%0A                                ___%0A      ___///___                /o o%5C            %0A%09 /         %5C               %5C _ /%0A  /%5C/   0   0   %5C/%5C          ___%5C%7C %5C__%0A  %5C_%5C   _____   /_/       __/  _/%5E /_  %5C__%0A     %5C_/ o o %5C_/       __/  %5C__________/  %5C__%0A      / _____ %5C       /  %5C________________/  %5C%0A      %5C_______/       %5C______________________/%5C%0A                                             %5C00o~-%0A____________________________________________________%0A@autor : hengki lodwig sirait a.k.a coltz %0Aandroid tester tools %0A'''%0A%0Aclass MonyetLiar:%0A%09def __init__(self, dev):%0A%09%09%22%22%22 Initialize the clazz for testing %22%22%22%0A%09%09print %22%5B+%5D Connecting to device%22%0A%09%09self.dev = dev%0A%09%09self.counter = 0;%0A%0A%09def writeLog(self, message):%0A%09%09print %22%5B+%5D %25s%22 %25 message%0A%0A%09def deleteTextMessage(self, xPosition, yPosition, action):%0A%09%09%22%22%22 %0A%09%09Need parameter position as operan x and y.%0A%09%09The better use is locate position for x and y on right-bootom of the  edittext field %0A%09%09this assume the maximum text field is 50 char%0A%09%09%22%22%22%0A%09%09self.dev.touch(xPosition, yPosition, action)%0A%09%09fieldLength = 50 #assume the length of text is 50 char%0A%09%09self.dev.press('KEYCODE_SHIFT_LEFT', MonkeyDevice.DOWN)%0A%09%09for i in range(fieldLength):%0A%09%09%09dev.press('KEYCODE_DPAD_LEFT', MonkeyDevice.DOWN_AND_UP)%0A%09%09%09%0A%09%09MonkeyRunner.sleep(1)%0A%09%09self.dev.press('KEYCODE_SHIFT_LEFT', MonkeyDevice.UP)%0A%09%09self.dev.press('KEYCODE_DEL', MonkeyDevice.DOWN_AND_UP)%0A%09%09MonkeyRunner.sleep(1)%0A%0A%09def writeText(self, xPos, yPos, action, str):%0A%09%09self.dev.touch(xPos, yPos, action)%0A%09%09self.dev.type(str)%0A%09%09MonkeyRunner.sleep(1)%0A%0A%09def press(self, xPos, yPos):%0A%09%09self.dev.touch(xPos, yPos, 'DOWN_AND_UP')%0A%09%09MonkeyRunner.sleep(1)%0A%0A%09def takeImage(self, name):%0A%09%09self.counter = self.counter + 1%0A%09%09fname = './images/screen_capture_'%0A%09%09if name :%0A%09%09%09fname = fname + %22%25s_%25d%22 %25 (name , self.counter)%0A%09%09fname = fname + %22.png%22%0A%09%09print fname%0A%09%09img = self.dev.takeSnapshot()%0A%09%09img.writeToFile(fname,'png')%0A%0A%0A#Exampleuse:%0Afrom com.android.monkeyrunner import MonkeyRunner, MonkeyDevice%0A%0Amon = MonyetLiar(MonkeyRunner.waitForConnection())%0Amon.writeLog('Starting test')%0Amon.press(20, 20) #will touch on the coordinate x=20 y=20%0Amon.takeImage(%22dodol%22)%0A

Create MonyetLiar.py