參考有圖詳細地址:https://www.jianshu.com/p/703476fb9467
本次環境配置相關:
macOS:10.13.4
Appium-desktop 用最新的
Xcode 用最新的
環境
1、 安裝homebrew:$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2、 安裝libimobiledevice:$ brew install libimobiledevice --HEAD
3、 安裝carthage:$ brew install carthage
4、安裝node:$ brew install node
5、安裝npm:$ brew install npm
6、安裝ios-deploy:$ npm install -g ios-deploy
8、安裝xcpretty:$ gem install xcpretty
9、安裝appium,appium-doctor進入官網,下載,安裝即可。
10、使用appium-doctor 檢查Appium iOS環境環境appium-doctor --ios
安裝WebDriverAgent
1、進入appium安裝目錄下WebDriverAgent文件夾,具體路徑參照自己的路徑,可以通過find命令查找
cd /Applications/Appium.app/Contents/Resources/app
/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent
2、在WebDriverAgent目錄下執行以下命令
mkdir -p Resources/WebDriverAgent.bundle
sh ./Scripts/bootstrap.sh
3、編譯WebDriverAgent.xcodeproj
Xcode打開當前目錄下的WebDriverAgent.xcodeproj文件
1、TARGETS->WebDriverAgentLib的Bundle Identifier更改為自己命名的Identifier。(所有Identifier注意保持一致!!)
2、TARGETS->WebDriverAgentLib的Signing選擇使用個人的證書。
3、TARGETS->WebDriverAgentRunner的Signing選擇使用個人的證書。
4、PROJECT->WebDriverAgent的Product Bundle Identifier更改為自己命名的Identifier。(所有Identifier注意保持一致!!)
5、TARGETS->WebDriverAgentLib的Product Bundle Identifier更改為自己命名的Identifier。(所有Identifier注意保持一致!!)
6、TARGETS->WebDriverAgentRunner的Product Bundle Identifier更改為自己命名的Identifier。(所有Identifier注意保持一致!!)
7、Device選擇已連接的測試機
8、點擊build按鈕來測試,按照步驟設置后,可build succeeded~
9、測試機上安裝證書,執行以下命令:
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=測試機的udid' test
如果沒有報錯證明安裝成功,同時手機上會安裝一個WebDriverAgent軟件。需要在手機設置->通用->設備管理->信任開發者
如果沒有報錯證
Appium Client有Ruby,Python,Java三個版本,可自行選擇自己喜歡的安裝即可 pip install Appium-Python-Client