一、安装JDK
官网下载对应版本直接安装
二、安装Android SDK
官网下载对应版本直接安装
https://www.androiddevtools.cn/
三、安装安卓模拟器
我使用的是夜神模拟器,官网下载直接安装
夜神安卓模拟器-安卓模拟器电脑版下载_安卓手游模拟器_手机模拟器_官网
四、安装Appnium Desktop
GitHub下载直接安装
Releases · appium/appium-desktop · GitHub
五、安装Appnuim Inspector
GitHub下载直接安装
https://github.com/appium/appium-inspector/releases
主要参数介绍与来源
1、deviceName:手机的名字
直接通过adb devices命令获取
2、platformVersion:当前安卓的版本
3、platformName:Android,固定写法
4、appPackage:app启动的包文件名(如下图:得到的是com.tencent.mobileqq)
5、appActivity:app启动的入口文件名(如下图:得到的是.activity.LoginActivity)
通过 dumpsys window windows | grep -i current 命令获取,代表当前是打开了手机QQ的登录活动
六、安装Appium-Python-Client
pip install Appium-Python-Client 直接安装
七、FAQ:
1、Appnuim Inspector打开Session报错
Failed to create session. An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: 'Command 'D:\\androidSDK\\platform-tools\\adb.exe -P 5037 -s f30a1e7b shell 'settings delete global hidden_api_policy_pre_p_apps;settings delete global hidden_api_policy_p_apps;settings delete global hidden_api_policy'' exited with code 255'; Command output: Exception occurred while executing 'delete': java.lang.SecurityException: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS at com.android.providers.settings.SettingsProvider.enforceWritePermission(SettingsProvider.java:2663) at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1635) at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1627) at com.android.providers.settings.SettingsProvider.deleteGlobalSetting(SettingsProvider.java:1598) at com.android.providers.settings.SettingsProvider.call(SettingsProvider.java:664) at android.content.ContentProvider.call(ContentProvider.java:2473) at android.content.ContentProvider$Transport.call(ContentProvider.java:521) at com.android.providers.settings.SettingsService$MyShellCommand.deleteForUser(SettingsService.java:408) at com.android.providers.settings.SettingsService$MyShellCommand.onCommand(SettingsService.java:282) at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97) at android.os.ShellCommand.exec(ShellCommand.java:38) at com.android.providers.settings.SettingsService.onShellCommand(SettingsService.java:50) at
解决方法:
进入手机开发者模式打开USB调试,并将模拟位置信息应用选择为Appnuim settings