Appium Appium 安装、启动 app 权限弹框问题

菜菜鸟 · 2018年05月22日 · 最后由 chenxing890 回复于 2018年09月14日 · 2862 次阅读

Android 版本升级后,一些手机安装和 启动 app 时需要权限申请,如 MIUI Flyme,
安装权限,根据手机的不同,关闭 usb 安装验证即可
启动时就要申请权限的,在 Capabilities 已经提供了方法
可以处理安装时、 启动时 权限弹框点不到的问题 包括打开应用后一些弹框也可以处理
红米 Note5 Android8.1 上验证过,

autoGrantPermissions (Android Only)
Have Appium automatically determine
which permissions your app requires and grant them to the app on install.
Defaults to false

autoAcceptAlerts (iOS Only)
Accept all iOS alerts automatically if they pop up.
This includes privacy access permission alerts (e.g., location, contacts, photos).
Default is false.
Does not work on XCUITest-based tests.

autoDismissAlerts(iOS Only)
Dismiss all iOS alerts automatically if they pop up.
This includes privacy access permission alerts (e.g., location, contacts, photos).
Default is false.
Does not work on XCUITest-based tests.

[https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md]

共收到 7 条回复 时间 点赞

这个只对 appium 1.6 以下的版本有效,使用 XCUITest 的没用

在 appium-desktop1.6.1,小米 6 真机(android8.0) 下亲测无效

用 aapt d permissions xxx.apk, 来查询包名和权限。
然后用 python 或者 java 执行:adb shell pm grant 包名 权限, 来赋予权限。

https://testerhome.com/topics/16067 对现在手机来说权限一般靠脚本去点击通过,这篇文章可以看看

usb 安装验证有的厂商根本无法开启啊,比如 vivo,就没有这个选项,通过 usb 无法自动安装

小米 5, 小米 6 Android 8.0.0 亲测, 没有作用.

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册