Appium iOS 测试 资料

目前我手机的版本是10.3.2 更高版本的手机,需要更高版本的Xcode

bundleId可以通过ideviceinstaller -l 查看

libimobiledevice命令集 https://www.cnblogs.com/578y/p/6043649.html

重装libimobiledevice方法

brew uninstall ideviceinstaller
brew uninstall libimobiledevice
brew install --HEAD libimobiledevice
brew link --overwrite libimobiledevice
brew install ideviceinstaller
brew link --overwrite ideviceinstaller

WebDriverAgent 项目

brew install carthage
git clone https://github.com/facebook/WebDriverAgent
./Scripts/bootstrap.sh
open ./WebDriverAgent.xcodeproj

配置教程 https://testerhome.com/topics/7220

iOS的DesiredCapabilities

参考

命令行运行方法

xcodebuild -project ./WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id=84ad172e22d8372eb752f413280722cdcc200954  test-without-building

命令行

常见错误

删除手机上已经安装的WebDriverAgent应用,重新安装。

brew 安装 libimobiledevice失败

大多数时权限问题,修改下即可

sudo chown -R $(whoami):admin /usr/local/

扩展wdaproxy

需要实现的接口

$ curl $DEVICE_URL/wd/hub/sessions
{
  "status": 0,
  "value": [],
  "sessionId": null
}

POST /wd/hub/session

Body

{
  "desiredCapabilities":{
    "automationName":"XCUITest",
    "bundleId":"com.apple.Preferences",
    "deviceName":"whatevere",
    "platformName":"iOS",
    "udid":"84ad172e22d8372eb752f413280722cdcc200954",
    "newCommandTimeout":0,
    "connectHardwareKeyboard":true
}}

Response

{
"status":0,
  "value":{
    "webStorageEnabled":false,
    "locationContextEnabled":false,
    "browserName":"",
    "platform":"MAC",
    "javascriptEnabled":true,
    "databaseEnabled":false,
    "takesScreenshot":true,"networkConnectionEnabled":false,"automationName":"XCUITest",
    "bundleId":"com.apple.Preferences","deviceName":"whatevere","platformName":"iOS",
    "udid":"84ad172e22d8372eb752f413280722cdcc200954","newCommandTimeout":0,"connectHardwareKeyboard":true
  },
  "sessionId":"6f30c4e0-692d-4807-8f1d-ae77ffae708e"
}

POST http://192.168.1.31:4723/wd/hub/session/6f30c4e0-692d-4807-8f1d-ae77ffae708e/context

Body

{"name":"NATIVE_APP"}

Response 这是一个错误的返回值,不知道正确的是啥

{"status":13,"value":{"message":"An unknown server-side error occurred while processing the command. Original error: Cannot read property 'startConsole' of undefined"},"sessionId":"6f30c4e0-692d-4807-8f1d-ae77ffae708e"}

Certificates 开发者证书
DeviceList 可内测内容
Ad-hoc
Provisioning Profiles 安装设备清单配置

参考资料

npm 代理配置

npm config set registry https://registry.npm.taobao.org/
npm config set disturl https://npm.taobao.org/dist
/Users/lys/Library/Developer/Xcode/DerivedData/UICatalog-hcftmytbfkpxluceqsirbnnljcbf/Build/Products/Debug-iphonesimulator/UICatalog.app
关闭