appcrawler 2.5 java8 appium 1.8.x
网盘下载地址
https://pan.baidu.com/s/1dE0JDCH
直接下载(本身是一个jar包,环境配置好即可)或从源代码编译
java -jar appcrawler-2.4.0-jar-with-dependencies.jar
例子(雪球app通过命令的方式启动):
java -jar appcrawler-2.4.0-jar-with-dependencies.jar --capability "appPackage=com.xueqiu.android,appActivity=.view.WelcomeActivityAlias"
生成样板配置示例
java -jar appcrawler.jar --demo
会在当前目录下生成一个demo.yaml
执行参数与配置文件(执行参数比配置文件优先级别高)
testcase
testcase的完整形态
given: 所有的先决条件
when: 先决条件成立后的行为
then: 断言集合
testcase的简写形态
xpath: 对应when里的xpath
action: 对应when的action
自动遍历支持
触发器 triggerAcions:
triggerActions:
- xpath: 指定具体按钮
action: 动作
times: 规则的使用次数
选取某个元素点击并滑动demo
testcase:
name: "TesterHome AppCrawler"
steps:
- xpath: "//*[@resource-id='com.xueqiu.android:id/profile_image']"
action: click
- xpath: //* 遍历所有元素
action: driver.swipe(0.5,0.9,0.5,0.1)
- xpath: "设置"
action: click
注:在执行driver.swipe()是会用到eval,需注意其后面所跟命令
弹框处理示例demo
testcase:
name: "TesterHome AppCrawler"
steps:
- xpath: //*[@resource-id='com.xueqiu.android:id/post_status']
action: click
triggerActions:
- xpath: //*[@resource-id='com.xueqiu.android:id/iv_action_back']
action: click
选取范围遍历demo的
selectedList:
- xpath: //*[@resource-id='com.xueqiu.android:id/tab_indicator_view']//android.widget.TextView
- xpath: //*[@resource-id='com.xueqiu.android:id/small_period_container']//android.widget.TextView
firstList:
- xpath: //*[@resource-id='com.xueqiu.android:id/tab_indicator_view']//android.widget.TextView
lastList:
- xpath: //*[@resource-id='com.xueqiu.android:id/small_period_container']//android.widget.TextView
信息的获取:
把当前app的界面dump为xml结构
获取待遍历元素
遍历范围 selectedList
过滤黑名单 小控件 不可见控件 blackList
重排控件顺序 firstList lastList
跳过已点击 + 跳过限制点击的控件tagLimit
根据匹配的规则执行action
循环上面步骤
# 启动已经安装的app
java -jar appcrawler-2.4.0-jar-with-dependencies.jar --capability "appPackage=com.xueqiu.android,appActivity=.view.WelcomeActivityAlias"
# 生成demo例子
java -jar appcrawler-2.4.0-jar-with-dependencies.jar --demo
# 根据需求编辑yaml文件
# 运行yaml文件
java -jar appcrawler-2.4.0-jar-with-dependencies.jar -c demo.yml
问题答疑:https://ceshiren.com/t/topic/889
# 从已经结束的结果中重新生成报告
java -jar appcrawler-2.4.0-jar-with-dependencies.jar --report result/