2339073008 发表于 2017-9-20 17:45:59

求大神赐教,用monkeyrunner截图时老报错

D:\Program Files\Java\adt-bundle-windows-x86-20130917\sdk\tools>monkeyrunner
Jython 2.5.3 (2.5:c56500f08d34+, Aug 13 2012, 14:54:35)
on java1.8.0_144
>>> from com.android.monkeyrunner import MonkeyRunner,MonkeyDevice,MonkeyImage
>>> devices=MonkeyRunner.waitForConnection(5,'4b37ca1d')
>>> devices.startActivity(component = 'com.jiaotong.app/.mvp.module.launch.Splas
hScreenActivity')
>>> devices.touch(351,1292,"DOWN_AND_UP")
>>> MonkeyRunner.sleep(5)
>>> result = device.takeSnapshot()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'device' is not defined
C:\Users\admin\Desktop\QQ截图20170920174330.png

报错

海海豚 发表于 2017-9-20 18:48:50

>>> from com.android.monkeyrunner import MonkeyRunner,MonkeyDevice,MonkeyImage
>>> devices=MonkeyRunner.waitForConnection(5,'4b37ca1d')
>>> devices.startActivity(component = 'com.jiaotong.app/.mvp.module.launch.Splas
hScreenActivity')
>>> devices.touch(351,1292,"DOWN_AND_UP")
>>> MonkeyRunner.sleep(5)
>>> result = device.takeSnapshot()
你在上面定义的是“devices”    然后截图时是“device”
这个错误提示的是你的“device”未定义

2339073008 发表于 2017-9-21 14:20:16

海海豚 发表于 2017-9-20 18:48
>>> from com.android.monkeyrunner import MonkeyRunner,MonkeyDevice,MonkeyImage
>>> devices=MonkeyRu ...

多谢

酸子茶 发表于 2017-10-10 14:21:59

000

酸子茶 发表于 2017-10-10 14:22:10

000
页: [1]
查看完整版本: 求大神赐教,用monkeyrunner截图时老报错