AppCrawler的学习笔记

2017-01-01 10:46

介绍

  • 一个基于自动遍历的app爬虫工具. 支持android和iOS, 支持真机和模拟器. 最大的特点是灵活性. 可通过配置来设定遍历的规则。查看-在线文档
  • 注意此工具是建立到appium基础之上,首先自己搭建好appium的环境

获取方式

  • 百度网盘: https://pan.baidu.com/s/1bpmR3eJ
  • 在线帮助文档: https://seveniruby.gitbooks.io/appcrawler/content/
  • AppCrawler交流专区: https://testerhome.com/topics/node83 论坛帖我会有问必答
  • 付费问答QQ群:177933995 能获取最新的内测版本参与交流, 收费10元. 收入分给可以回答小白问题的群管. 心痛者慎入

运行

  • gui点击启动

Paste_Image.png

  • 命名启动
appium --session-override
  • 我的json参数设置,现在只是测试了安卓
---
pluginList:

- "com.xueqiu.qa.appcrawler.plugin.TagLimitPlugin"
- "com.xueqiu.qa.appcrawler.plugin.ReportPlugin"
#- "com.xueqiu.qa.appcrawler.plugin.ProxyPlugin"
logLevel: "TRACE"
saveScreen: true
screenshotTimeout: 20
tagLimitMax: 3
currentDriver: "android"
maxTime: 10800
resultDir: ""
capability:
  newCommandTimeout: 120
  launchTimeout: 120000
  platformVersion: ""
  platformName: ""
  autoWebview: "false"
  autoLaunch: "true"
  noReset: "false"
androidCapability:
  deviceName: "JTJ4C16331013562"
  appPackage: "cn.ibona.t1_beta"
  appActivity: "cn.ibona.t1.main.ui.activity.SplashActivity"
  app: "d:/t13.2.2.apk"
  appium: "http://127.0.0.1:4723/wd/hub"
maxDepth: 20
headFirst: true
enterWebView: true

selectedList:
#android非空标签

- //*[clickable="true"]
- //*[clickable="true"]//android.widget.TextView[string-length(@text)>0 and string-length(@text)<20]
- //android.widget.EditText
- //*[contains(name(), 'Text') and string-length(@text)>0 and string-length(@text)<20 ]

triggerActions: # 这里可以设置触发器

- action: "click"
  xpath: "//*[@resource-id='com.huawei.systemmanager:id/btn_allow']"
  times: 0

- action: "click"
  xpath: "//*[@resource-id='cn.ibona.t1_beta:id/btn_skip']"
  times: 0

- action: "12345678911"
  xpath: "//*[@resource-id='cn.ibona.t1_beta:id/phoneNumberEditText']"
  times: 1

- action: "click"
  xpath: "//*[@resource-id='cn.ibona.t1_beta:id/start_button']"
  times: 1

- action: "123456"
  xpath: "//*[@resource-id='cn.ibona.t1_beta:id/passwordEditText']"
  times: 1

- action: "click"
  xpath: "//*[@resource-id='cn.ibona.t1_beta:id/loginButton']"
  times: 1
startupActions: # 这里是滑动,可以设置swipe("down")

- swipe("left")
- swipe("left")
- swipe("left")
- swipe("left")
- println(driver)
#beforeElementAction:
#- Thread.sleep(3000)
#- println(driver.getPageSource())
afterElementAction:

- println(driver)
#- println(driver.getPageSource)
#- Thread.sleep(3000)
  • 设置上面参数后执行:
appcrawler -a d:\t13.2.2.apk -c E:\app\appcrawler-1.7.1\conf\t1.yml

就会开始自动的遍历你的应用的UI了,并且各个步骤有截图

两个版本对比

  • 如果想对比两次遍历的版本
appcrawler --diff --master E:\app\appcrawler-1.7.1\bin\Android_20161206162754 --candidate E:\app\appcrawler-1.7.1\bin\Android_20161206165446\ --report d:\diff

Paste_Image.png