前言
本篇基本原理是通过在 Android 虚拟机上安装企业微信,然后通过 Appium 的方式模拟 Android 操作进行加微操作。脚本形式主要使用规范 KoolTest。
所需资源
1,genymotion www.genymotion.com/download/
2,企业微信 apk work.weixin.qq.com/#indexDownl…
3,appium github.com/appium/appi…
准备工作
1,安装企业微信到 genymotion 的虚拟机上,拖拽 apk 到虚拟机或者使用 adb 方式
Q:安装时遇到 CPU 类型问题?
A:由于企业微信apk限制了只能在 ARM 架构下安装,所以此时我们需要给 genymotion 的虚拟机安装一个 ARM-Translation,下载对应系统版本的 Translation 拖拽进虚拟机安装。
2,安装 Appium 后运行,此时会在本地运行一个 Appium Server。
3,git clone github.com/CPPAlien/we… 运行 .start.sh,注意修改 config/device.yml,udid 改成自己设备的 udid。
脚本解释
@noReset
Feature: 增加微信好友
Scenario: 加企业微信好友
* tap "通讯录"
* tap "我的客户"
* tap "添加"
* tap "搜索手机号添加"
* input "18600607765" to "手机号"
* tap "*网络查找手机*"
* ?tap "element://用户微信"
* tap "添加为联系人"
* tap "发送添加邀请"
* assert_toast "已发送"