1.下载Appium-mac-1.15.1.dmg(本文是用到这版本),链接地址:https://github.com/appium/appium-desktop/releases
下载依赖包
brew install carthage
brew install node
brew install npm
npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install -g ios-deploy
gem install xcpretty
cnpm install -g appium-doctor
使用appium-doctor检查appium环境
appium-doctor
2.打开Appium DeskTop,在 Desired Capabilities那里填写:
{
"platformName": "ios",
"deviceName": "iPhone",
"platformVersion": "13.3",
"udid": "044d08066777170495caec7d8fb34d3c4981d5df",
"bundleId": "JF.CCTest.jufangbao",
"xcodeOrgId": "FUL8MVVQ4H",
"xcodeSigningId": "iPhone Developer"
}
3.右键Appium.app,显示Contents所在的目录路径,进入到appium-webdriveragent文件夹
cd /Applications/Appium.app/Contents/Resources/app/node_modules/appium-webdriveragent
创建WebDriverAgent.bundle
mkdir -p Resources/WebDriverAgent.bundle
执行脚本
sh ./Scripts/bootstrap.sh
4.打开WebDriverAgent.xcodeproj。修改每个target的bundle id 为你要测试的app的bundle id.
5.在appium-webdriveragent文件夹目录下,执行以下命令:(注意:id=xxx)(xxx为你的手机udid),测试是否正常运行
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=044d08066777170495caec7d8fb34d3c4981d5df' test