-
購買Mac
PDD 比TB JD 便宜500,下單
![](https://img.laitimes.com/img/_0nNw4CM6IyYiwiM6ICdiwiInVGcq5yYzUmYzUDNhhzN0UGNhNWNjljZ2UjNlZTNxgzYyIGN58CX0JXZ252bj91Ztl2Lc52YucWbp5GZzNmLn9Gbi1yZtl2Lc9CX6MHc0RHaiojIsJye.jpeg)
-
安裝homebrew
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
-
安裝npm cnpm
brew install node;
npm install -g cnpm --registry=https://registry.npm.taobao.org;
-
安裝類似Android的adb
安裝 libimobiledevice, ideviceinstaller:
brew install libimobiledevice;
brew install ideviceinstaller;
-
安裝Appium
Requirements
- macOS, Linux or Windows operating system
- Node.js 14+
- NPM (Node Package Manager) 8+
指令行安裝
sudo cnpm install -g appium
Gui安裝
https://github.com/appium/appium-desktop/releases/latest
-
安裝Appium Inspector
https://github.com/appium/appium-inspector/releases/tag/v2022.11.1
官網下載下傳太慢,是以上傳CSDN
-
安裝Xcode
App Store
-
Build WDA
-
下載下傳WDA代碼
推薦github desktop 下載下傳代碼,簡單友善快捷
https://github.com/appium/WebDriverAgent
-
打開手機的開發者模式,連接配接Mac
-
Xcode 打開并且修改 簽名資料
這塊參考
https://blog.csdn.net/liuage_/article/details/124508920
(1) 設定【WebDriverAgentLib】、【WebDriverAgentRunner】、【IntegrationApp】的Team,選擇自己登入的Apple ID,登入Apple ID:(左上角Xcode-》Preferrence-》點選下面的進行增删)
(2)設定【WebDriverAgentRunner】、【IntegrationApp】Build Settings下Packaging目錄下Product Bundle Identifier的id,把其中facebook改掉就行,自己随意改
(3) 設定【Product】→【Scheme】選擇【WebDriverAgentRunner】
(4) 選中自己連接配接的裝置,command + u 運作即可
(5) 第一次運作需要在真機設定裡面給證書設定信任【設定】→【通用】→【VPN與裝置管理】選擇開發者APP下面剛安裝的WebDriverAgent信任即可,在次command+u即可正常運作,啟動成功後Xcode下面會出一串URL
(6) 然後關閉Xcode服務 ,Xcode也可以關閉了,WebDriverAgent配置完成
-
使用Inspector檢視手機
-
打開appium Gui
預設設定
-
打開appium inspector
remote path /wd/hub/
配置
{
"platformName": "ios",//蘋果手機預設
"appium:platformVersion": "16.1",//ios版本
"appium:udid": "xxxxx-00113xxx",//idevice_id -l
"appium:deviceName": "SuperXX",//裝置名
"appium:automationName": "Appium",//預設
"xcodeSigningId":"iPhone Developer",//預設
"xcodeOrgId":"WS6RPRBF68" //keychain 組織機關
}
搞定
10. 問題合集
TBD