检查= MonkeyRunner.loadImageFromFile(CHK)
检查= MonkeyRunner.loadFromFile(CHK)
检查= MonkeyImage.loadFromFile(CHK)
以上所有都给错误
追溯(最近一次通话):
在第1行的文件“ stdin”中
AttributeError:类型对象'com.android.monkeyrunner.MonkeyRunner'没有attri
e'loadFromFile'
最佳答案
要查看monkeyrunner中的内容,请运行以下脚本:
#! /opt/android-sdk/tools/monkeyrunner
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice, MonkeyImage
for m in [MonkeyRunner, MonkeyDevice, MonkeyImage]:
print "%s:\n %s\n" % (m.__name__, dir(m))
您将看到定义的内容和位置。例如,SDK中的monkeyrunner返回
MonkeyRunner:
['__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', 'alert', 'choice', 'help', 'input', 'sleep', 'waitForConnection']
MonkeyDevice:
['DOWN', 'DOWN_AND_UP', 'UP', '__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', 'broadcastIntent', 'drag', 'getProperty', 'getSystemProperty', 'installPackage', 'instrument', 'press', 'reboot', 'removePackage', 'shell', 'startActivity', 'takeSnapshot', 'touch', 'type', 'wake']
MonkeyImage:
['__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', 'convertToBytes', 'getRawPixel', 'getRawPixelInt', 'getSubImage', 'sameAs', 'writeToFile']
如果不是您期望的那样,请从源代码构建。
关于android - 想要运行Monkeyrunner加载图像以在Windows平台中进行比较,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5881712/