早教吧 育儿知识 作业答案 考试题库 百科 知识分享

monkeyrunner脚本报错,不加foriinrange一切正常,加了就报错#Importsthemonkeyrunnermodulesusedbythisprogramfromcom.android.monkeyrunnerimportMonkeyRunner,MonkeyDevice,MonkeyImage#Connectstothecurrentdevice,returningaMon

题目详情
monkeyrunner脚本报错,不加for i in range一切正常,加了就报错
# Imports the monkeyrunner modules used by this program
from com.android.monkeyrunner import MonkeyRunner,MonkeyDevice,MonkeyImage
# Connects to the current device,returning a MonkeyDevice object
device = MonkeyRunner.waitForConnection()
# Runs the component
device.startActivity(component = "com.cyou.mrd.fk/cn.cmgame.billing.ui.GameOpenActivity")
MonkeyRunner.sleep(5)
device.touch(253,558,'DOWN_AND_UP')
MonkeyRunner.sleep(5)
device.touch(345,510,'DOWN_AND_UP')
MonkeyRunner.sleep(5)
device.touch(231,538,'DOWN_AND_UP')
MonkeyRunner.sleep(10)
for i in range(1,3):
device.drag((13,646),(462,646),0.1,1)
MonkeyRunner.sleep(1)
device.drag((462,646),(10,646),0.1,1)
MonkeyRunner.sleep(1)
device.touch(450,36,'DOWN_AND_UP')
MonkeyRunner.sleep(1)
device.touch(184,448,'DOWN_AND_UP')
▼优质解答
答案和解析
for i in range(次数):
循环脚本
------------------------------------
报错了一定是你脚本写错了