Code Bye

请教 :monkeyrunner 测试工具的简单使用

from com.android.monkeyrunner import MonkeyRunner,MonkeyDevice,MonkeyImage
device=MonkeyRunner.waitForConnection(1.0,"5069b007")
device.startActivity(component="com.android.contacts/com.android.contacts.DialtactsContactsEntryActivity")
MonkeyRunner.sleep(3)
for i in range(1,999999):
    MonkeyRunner.sleep(4)
	device.touch(23,36,MonkeyDevice.downAndUp)
    MonkeyRunner.sleep(4)
    device.touch(241,,906,MonkeyDevice.downAndUp)
    MonkeyRunner.sleep(4)
    print i
else:
    print("end")

小弟是刚开始学者,以上代码,就是实现一个简单的连续点击2个屏幕坐标的操作,但运行报错。
C:\Users\Administrator>monkeyrunner 234.py
150713 16:09:03.648:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] Scri
pt terminated due to an exception
150713 16:09:03.648:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions]Synta
xError: (“mismatched input “” expecting DEDENT”, (“D:\adt-bundle-windows\sdk\
tools\234.py”, 7, 1, “\tdevice.touch(23,36,MonkeyDevice.downAndUp)\n”))
150713 16:09:03.648:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions]
at org.python.core.ParserFacade.fixParseError(ParserFacade.java:92)
150713 16:09:03.648:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions]
at org.python.core.ParserFacade.parse(ParserFacade.java:184)
150713 16:09:03.648:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions]
at org.python.core.Py.compile_flags(Py.java:1731)
150713 16:09:03.648:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions]
at org.python.core.__builtin__.execfile_flags(__builtin__.java:514)
150713 16:09:03.648:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions]
at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:225)
150713 16:09:03.648:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions]
at com.android.monkeyrunner.ScriptRunner.run(ScriptRunner.java:116)
150713 16:09:03.648:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions]
at com.android.monkeyrunner.MonkeyRunnerStarter.run(MonkeyRunnerStarter.java:77)
150713 16:09:03.648:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions]
at com.android.monkeyrunner.MonkeyRunnerStarter.main(MonkeyRunnerStarter.java:18
9)

解决方案

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明请教 :monkeyrunner 测试工具的简单使用