Mac Appium 运行
iOS 运行
WebDriverAgent 工程配置

需要提前准备一个开发者账号 $99
运行WebDriverAgent
工程运行
选择target
选择设备
运行
命令行运行
获取设备udid1
idevice_id -l
cd WebDriverAgent工程目录下1
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination "id=设备的udid" USE_PORT=8100 test
命令行使用脚本执行
命令行的执行方式可以结合成sh脚本 ,这个步骤不是必须的
新建 sh 文件
cd WebDriverAgent工程目录下1
vi start.sh
输入内容1
2
3
4
5
6
7
8
9
10# 解锁keychain,以便可以正常的签名应用,PASSWORD是你自己mac电脑的开机密码
# 这个步骤不是必须的
PASSWORD="xxxx"
security unlock-keychain -p $PASSWORD ~/Library/Keychains/login.keychain
# 获取设备的UDID
UDID=$(idevice_id -l | head -n1)
# 运行测试
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination "id=$UDID" USE_PORT=8100 test
运行1
sh start.sh
Appium server 运行

直接打开 Appium Server GUI - startServer
Appium inspector 运行

配置内容参考:1
2
3
4
5
6
7
8{
"platformName": "iOS",
"platformVersion": "15.3.1",
"deviceName": "iPhone8",
"automationName": "XCUITest",
"bundleId": "",
"udid": ""
}
Remote Path 要填 /wd/hub:
1 | idevice_id -l // 获取 udid |
Android
配置内容参考1
2
3
4
5
6
7
8{
"platformName": "Android",
"platformVersion": "12",
"deviceName": "8BMY112RJ",
"appPackage": "",
"appActivity": "",
"automationName": "UiAutomator2"
}
获取 deviceName1
adb devices
获取 platformVersion1
adb shell getprop ro.build.version.release
获取 appActivity 和 appPackage1
adb logcat|grep "START"
先执行上述指令,再冷启动APP1
02-29 15:48:44.809 2215 3584 I ActivityTaskManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=包名在这/Activity在这 bnds=[585,1300][855,1694]} from uid 10153
遇到问题
Neither ANDROID_HOME nor ANDROID_SDK_ROOT environment variable was exported
1 | Error |

在 Appium gui - Edit Configurations 设置环境变量
Could not find a connected Android device
1 | Error |
查看手机有没有连接成功
Cannot start the ‘XXX’ application
1 | Cannot start the 'XXX' application |
确认 appActivity 是否正确,最好设置从启动页开始
Could not proxy command to the remote server
1 | Error |
可能是执行appium 上个进程没有关闭导致的
- 删除手机里的 Appium setting,给appium 换个服务端口
- 重启大法 搞定
