定向班第二期_app 自动化_191106

App自动化技术

npm install -g cnpm --registry=https://registry.npm.taobao.org 
cnpm install -g appium

创建模拟器

  • andorid studio创建或者avdmanager create avd
  • genymotion
  • 网易mulu

启动模拟器

$(which emulator) -list-avds
$(which emulator) @Pixel_2_API_27

演练app:https://sj.qq.com/myapp/detail.htm?apkName=com.xueqiu.android

第一个录制用例

noReset

消除权限

  • 第一种:noReset=true
  • 第二种:noReset=false + autoGrantPermissions=true
  • 第三种:小米手机等可能会魔改导致失效,先安装并借住Uiautomator先点掉这些弹框(adb install &; adb shell uiautomator + adb shell input )
  • 第四种:先什么都不启动和安装,然后启动appium后,再使用install app安装
  • 或者使用Uiautomator的watch机制(可能会跟appium冲突)
  • 通过手机设置让adb可以自行安装不需要弹框

autograntpermission

[debug] [ADB] Running '/Users/seveniruby/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell pm grant com.xueqiu.android android.permission.WRITE_EXTERNAL_STORAGE \\; pm grant com.xueqiu.android android.permission.READ_PHONE_STATE \\; pm grant com.xueqiu.android android.permission.ACCESS_FINE_LOCATION \\; pm grant com.xueqiu.android android.permission.ACCESS_COARSE_LOCATION \\; pm grant com.xueqiu.android android.permission.READ_CALENDAR \\; pm grant com.xueqiu.android android.permission.WRITE_CALENDAR \\; pm grant com.xueqiu.android android.permission.READ_EXTERNAL_STORAGE \\; pm grant com.xueqiu.android android.permission.RECORD_AUDIO \\; pm grant com.xueqiu.android android.permission.CAMERA \\; pm grant com.xueqiu.android android.permission.REQUEST_INSTALL_PACKAGES \\; pm grant com.xueqiu.android android.permission.WRITE_SETTINGS \\; pm grant com.xueqiu.android android.permission.MOUNT_UNMOUNT_FILESYSTEMS \\; pm grant com.xueqiu.android android.permission.CALL_PHONE \\; pm grant com.xueqiu.android android.permission.USE_FACERECOGNITION \\;'
关闭