monkeyrunner总结

device=MonkeyRunner.waitForConnection()   //手机连接

result = device.takeSnapshot()    //截图

result.writeToFile("d:dialer.png","png")   //保存在d盘 命名为dialer.png

hui=result.getSubImage((200,400,200,400))    //截取(200,400,200,400)这么大的内容

picture = MonkeyRunner.loadImageFromFile('d:shotbegin.png','png')   //与shotbegin.png这个图片对比

hui1=picture.getSubImage((200,400,200,400))

ggg=hui.sameAs(hui1,1.0)   //对比

print ggg    //相同返回true不同返回false

原文地址:https://www.cnblogs.com/dreamy890322/p/4076448.html