前言
目前自己已知的,python对app的操作大概有两种
1、在自动化测试中,需要使用手机通过usb连接电脑。
2、使用模拟器,安装app,模拟人的行为。
准备材料
1、pyhon运行环境
2、夜shen模拟器
3、夜shen模拟器安装xain鱼app,并且登录
说明
1、偶然发现,自己发布在xain鱼上的内容,自己可以点进去出来再点进去再出来刷浏览量,从而使浏览量破千破万。
开始
1、未使用脚本前的浏览量
2、使用自动化点击之后的浏览量,中间呢,修改了一下内容。
3、整个过程就相当简单,具体效果已上传到B站。
搜索
注意点
流程如下:
1、打开夜神模拟器
2、点击xain鱼App(请提前截图)
3、点击我的(请提前截图)
4、点击我发布的(请提前截图)
5、点击测试自动化脚本(请提前截图)
6、点击返回(请提前截图)
然后不断重复5-6即可。
当然其中可能包括一些乱弹窗之类的,要想办法去除掉,比如开启子线程,当碰到一些其他的场景能够正常返回到你主线任务上去即可。
import datetime
import threading
import time
import lackey
import psutil
import pywinauto
class utils:
# 尝试锁定并点击 Try locking and clicking
def try_lock_and_click(self, png_path='', message='', button='left', custom_time_out=0):
printInfo(message)
time_out = 120
while time_out > 0:
try:
time.sleep(custom_time_out)
screen = lackey.Screen()
match = screen.findBest(pattern=lackey.Pattern(png_path))
if button in 'left':
screen.click(match)
if button in 'right':
screen.rightClick(match)
printInfo('锁定[' + message + ']成功!')
time.sleep(2)
return True
except Exception as e:
printInfo('查找【' + message + '】失败,重新搜索中...')