你可以先把视频每秒截图一张。
然后只要把连续的截图后一张对前一张比较,找到差异大的就可以发现图像有变化
先看看tap是什么,定义在了TouchAction中,代码如下def tap(self, element=None, x=None, y=None, count=1):
"""Perform a tap action on the element
:Args:
- element - the element to tap
- x - (optional) x coordinate to tap, relative to the top left corner of the element.
- y - (optional) y coordinate. If y is used, x must also be set, and vice versa
:Usage:
"""
opts = self._get_opts(element, x, y)
opts['count'] = count
self._add_action('tap', opts)
return self
实际的使用中根据这个来自定义一些方法来用,比如你这个点击屏幕,可以定义如下,后面传递参数即可
def tap_screen(self, x, y):
self.action.tap(None, x, y).perform()
另外我这边是计算中心坐标是除以2,是没问题的。比如你这个就是center_x = w / 2,center_y = y / 2,后面直接调用tap_screen(center_x,center_y)就行了
你是ython3还是Python2?它们运行暂停的方法也有所不同,以python3为例:1、input()
这种方法不用包含模块,因此这也是最常用的一种暂停手段。
Python2中的raw_input()和input()语句在Python3中已经被合并到input()中。
2、os.system("pause")
这种方法需要包含os模块(import os),在windows下IDLE运行会弹出cmd命令行,
进行暂停操作,直接运行.py文件会直接在命令行中暂停。
3、time.sleep("second")
这种方法需要包含time模块(import time),second是自定义的时间长短,根据实际情况,