by 西西
总结:加班 + 背锅

| Platform | Driver | Platform Versions | Appium Version | Driver Version |
|---|---|---|---|---|
| iOS | XCUITest | 9.3+ | 1.6.0+ | All |
| UIAutomation | 8.0 to 9.3 | All | All | |
| Android | Espresso | ?+ | 1.9.0+ | All |
| UiAutomator2 | ?+ | 1.6.0+ | All | |
| UiAutomator | 4.3+ | All | All | |
| Mac | Mac | ?+ | 1.6.4+ | All |
| Windows | Windows | 10+ | 1.6.0+ | All |
- Android 环境配置
https://ceshiren.com/t/topic/2270
- iOS 环境配置
https://ceshiren.com/t/topic/5530
- 几点建议:
1、Appium Desktop版本不要太老1.15以上
2、Java 1.8
3、SDK build-tools/ 下对应的版本,需要使用<=29的版本
配置待测应用

app 入口,两种方式获取:
1、通过 logcat 日志获取
mac/Linux: adb logcat ActivityManager:I | grep “cmp"
windows: adb logcat ActivityManager:I | findstr "cmp" 后启动目标应用
2、通过 aapt 获取
mac/Linux: aapt dump badging wework.apk | grep launchable-activity
Windows: aapt dump badging wework.apk | findstr launchable-activity
启动应用命令
adb shell am start -W -n <package-name>/<activity-name> -S
| Language/Framework | Github Repo and Installation Instructions |
|---|---|
| Ruby | https://github.com/appium/ruby_lib, https://github.com/appium/ruby_lib_core |
| Python | https://github.com/appium/python-client |
| Java | https://github.com/appium/java-client |
| JavaScript (Node.js) | https://github.com/admc/wd |
| JavaScript (Node.js) | https://github.com/webdriverio/webdriverio |
| JavaScript (Browser) | https://github.com/projectxyzio/web2driver |
| Objective C | https://github.com/appium/selenium-objective-c |
| PHP | https://github.com/appium/php-client |
| C# (.NET) | https://github.com/appium/appium-dotnet-driver |
| RobotFramework | https://github.com/serhatbolsu/robotframework-appiumlibrary |
前提条件
已登录状态( noReset=True)
打卡用例:
1、打开【企业微信】应用
2、进入【工作台】
3、点击【打卡】
4、选择【外出打卡】tab
5、点击【第N次打卡】
6、验证【外出打卡成功】
7、退出【企业微信】应用
DesireCapability 配置
caps["noReset"] = "true"
caps['settings[waitForIdleTimeout]'] = 0 # 等待页面空闲的时间
caps['skipServerInstallation'] = ‘true' # 跳过 uiautomator2 server的安装
caps['skipDeviceInitialization'] = ‘true' # 跳过设备初始化
caps['dontStopAppOnReset'] = ‘true' # 启动之前不停止app
滚动查找元素:
self.driver.find_element(MobileBy.ANDROID_UIAUTOMATOR,'new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().text("添加成员").instance(0));')
使用 Appium 实现自动化添加联系人