Appium是一個自動化測試開源工具,支持iOS平臺和Android平臺上的原生應用,web應用和混合應用。
本次環境配置相關:
MacOS的:10.13.4
Appium桌面:1.13.0
Xcode中:9.3.1
一,環境配置
1,安裝homebrew:
$ /usr/bin/ruby -e"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2,安裝libimobiledevice:
$ brew installlibimobiledevice --HEAD
3,安裝carthage:
$ brew install carthage
4,安裝node:
$ brew install node
5,安裝npm:
$ brew install npm
6,安裝ios-deploy:
$ npm install -g ios-deploy
7,安裝xcpretty:
$ gem install xcpretty
8,安裝appium,appium-doctor:
進入官網,下載 Appium-mac-1.13.0.dmg,安裝即可。
9,使用appium-doctor 檢查Appium ios 環境:
appium-doctor --ios
info AppiumDoctor Appium Doctor v.1.4.3
info AppiumDoctor ### Diagnostic starting ###
info AppiumDoctor ✔ The Node.js binary was found at: /usr/local/bin/node
info AppiumDoctor ✔ Node version is 10.1.0
info AppiumDoctor ✔ Xcode is installed at: /Applications/Xcode.app/Contents/Developer
info AppiumDoctor ✔ Xcode Command Line Tools are installed.
info AppiumDoctor ✔ DevToolsSecurity is enabled.
info AppiumDoctor ✔ The Authorization DB is set up properly.
info AppiumDoctor ✔ Carthage was found at:/usr/local/bin/carthage
info AppiumDoctor ✔ HOME is set to: /Users/wangjuan
info AppiumDoctor ### Diagnostic completed, no fix needed. ###
info AppiumDoctor
info AppiumDoctor Everything looks good, bye!
info AppiumDoctor
二,安裝WebDriverAgent
1,進入appium安裝目錄下WebDriverAgent文件夾,具體路徑參照自己的路徑,可以通過find命令查找
1、cd /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent
2,在WebDriverAgent目錄下執行以下命令:
1、mkdir -p Resources/WebDriverAgent.bundle
2、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
10,如果沒有報錯證明安裝成功,同時手機上會安裝一個WebDriverAgent軟件。需要在手機設置->通用->設備管理->信任開發者。如下圖:
三,Appium Client端
1,Appium Client有Ruby,Python,Java三個版本,可自行選擇自己喜歡的安裝即可,本次只針對Python版安裝:
pip install Appium-Python-Client