from com.android.monkeyrunner import MonkeyRunner,MonkeyDevice,MonkeyImage
#device = MonkeyRunner.waitForConnection()
#device.startActivity(component="com.lenovo.scg/.camera.CameraLauncher")
#MonkeyRunner.sleep(1)
def take_picture(device):
for i in range(1,5):
MonkeyRunner.sleep(2)
device.touch(541,1761,'DOWN_AND_UP')
def switch_camera(device):
MonkeyRunner.sleep(3)
device.touch(989,89,'DOWN_AND_UP')
def enter_camera(device):
device.touch(413,1101,'DOWN_AND_UP')
MonkeyRunner.sleep(2)
def exit_camera(device):
MonkeyRunner.sleep(2)
device.press('KEYCODE_HOME', MonkeyDevice.DOWN_AND_UP)
MonkeyRunner.sleep(3)
def TEST_LOOP(device):
enter_camera(device)
take_picture(device)
switch_camera(device)
take_picture(device)
exit_camera(device)
def main():
print "Start"
device = MonkeyRunner.waitForConnection()
if not device:
print "Couldn't get connection"
sys.exit()
print "Found device"
for i in range(1,300):
TEST_LOOP(device)
print(i)
if __name__ == '__main__':
main()