安裝 libimobiledevice
brew install libimobiledevice --HEAD
在命令行輸入ideviceinfo
出現報錯我是依照下面命令重新安裝(原因我也不知道)
brew uninstall ideviceinstaller
brew uninstall libimobiledevice
brew install --HEAD libimobiledevice
brew link --overwrite libimobiledevice
brew install ideviceinstaller
brew link --overwrite ideviceinstaller
安裝usbmuxd
brew install --HEAD usbmuxd
安裝xcode
我用的是macOS10.15 + xCode11.1
-
在app 搜索Xcode 點擊安裝。
舊mac 系統不兼容最新版的xcode 可以到(https://developer.apple.com/download/more/)這裏搜索較低的版版進行安裝 -
安裝 Command Line Tools
在終端機裏輸入指令:
xcode-select --install
在終端機輸入:
xcode-select -p
顯示出: /Applications/Xcode.app/Contents/Developer
即是成功安裝!
ps 自己下載舊版xcode 如果不在 /Applications/Xcode.app/Contents/Developer,可以自行移到/Applications 目錄下
安裝carthage:
brew install carthage
或有需要更新 brew upgrade carthage
安裝node:
brew install node
安裝npm:
brew install npm
安裝appium
1, npm install -g appium
命令行的appium
2, Desktop appium 安裝 https://github.com/appium/appium-desktop/releases
ps :npm 安裝appium 也可通過
appium --session-override -p %s -bp %s -U %s
啓動appium server,但桌面版appium 會更加方便。
安裝ios-deploy:
npm install -g ios-deploy
或 brew install ios-deploy
更新Appium中的WebDriverAgent
有一些教程會說從 GitHub 下載 Facebook 版 WebdriverAgent, 簽名後複製到 Appium 的對應文件夾裏。我試過發現 Facebook 版因爲不再維護有些功能是沒有的,現在直接用 Appium 項目裏的 WebDriverAgent 就可以了。
使用xCode 打開 /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj
- 在TARGETS
- WebDriverAgentLib -> Signing&Capabilities ->Team 選擇開發者賬號(需要已登記測試機設備)
- WebDriverAgentRunner 同上
我是把所有 Target 都簽了一遍,不知道有沒必要。
- 簽完後選擇 WebDriverAgentRunner 作爲 Target, Device 選擇用數據線連接着的 iOS 真機。
從菜單欄選擇 Product -> Test。
Xcode 將編譯項目,在真機上安裝
Appium Desktop
配置:{
“xcodeOrgId”: “找開發要”,
“xcodeSigningId”: “iPhone Developer”,
“platformName”: “iOS”,
“platformVersion”: “12.4”, 根據測試機實際版本
“deviceName”: “iPhone 8 Plus”,根據測試機實際型號
“bundleId”: “找開發要”,
“automationName”: “XCUITest”,
“udid”: “” xCode -> Window -> Devices and … 可以看到連接上的iPhone udid
}
參考引用
brew install ios-deploy 安裝失敗
Mac安裝Appium,自動化iOS APP
iOS 測試 WebDriverAgent 天坑記