1.6 airtest控制MUMU模拟器

自动化微信消息发送与页面翻页脚本
该博客介绍了一个使用Airtest和Poco库实现的自动化脚本,用于连接设备、登录微信并自动发送消息。脚本通过解析YAML配置文件获取参数,并使用循环等待节点的方法实现页面元素的定位和交互。当检测到重复消息时,脚本会自动发送预设文本并翻页。整个流程包括设备连接、密码登录、消息过滤和发送、页面滑动等步骤。

pocoui:https://poco.readthedocs.io/zh_CN/latest/source/README.html 

aritest:https://airtest.doc.io.netease.com/IDEdocs/airtest_framework/8_airtest_using/

环境

MUMU模拟器:2.6.30.0
python:3.8.5
adb:添加进环境变量,adb的环境变量可以添加IDE中adb.exe的路径
ide:下载airtest IDE

1、utils/connect.py

__author__ = 'xiao'

from airtest.core.api import *
from airtest.core.error import AdbError, DeviceConnectionError


# use url to connect application
def connect(url, name):
    try:
        connect_device(url)
        start_app(name)
    except [DeviceConnectionError, AdbError]:
        print('connect error')
    else:
        print('connect success')

 2、utils/login_wechat.py

__author__ = 'xiao'

from poco.drivers.android.uiautomation import AndroidUiautomationPoco
from poco.exceptions import PocoNoSuchNodeException

from utils import resolve_yaml
from utils.wait_node import *

poco = AndroidUiautomationPoco()
config = resolve_yaml.resolve('./config/setting.yaml')


# password login
def login_with_passwo
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值