Appium笔记
1Appium设备连接的关键机制
-
单一设备连接时的默认行为 :
- 当系统中只有一个Android设备(通过ADB识别)连接时,Appium会忽略 deviceName 参数的具体值
- 这种设计是为了方便测试,避免在只有一台设备的情况下还需要精确配置设备名称
- 这就解释了为什么配置文件中写的是 xxx,但依然能连接到您的手机
-
deviceName参数的实际作用 :
- deviceName 参数主要在 多设备连接 的场景下发挥作用
- 当有多个设备连接时,Appium会尝试通过 deviceName 来匹配要使用的设备
- 如果只有 deviceName 而没有指定 udid ,在多设备环境下可能会导致连接到错误的设备
2 Appium 1.x 版本使用appium inspect
- 路径需要填写/web/hub
- 配置文件如下
{"platformName": "android","appium:options": {"automationName": "uiautomator2","deviceName": "xxx","noReset": true,"appPackage": "com.tencent.mm","appActivity": ".ui.LauncherUI","autoGrantPermissions": true,"hideKeyboard": true}
}