基于Appium、Python的自動化測試環境部署和實踐(3)
3.2.2 Appium安裝過程 安裝brew :終端輸入ruby e $(curl fsSL https://raw.githubusercontent.com/Homebrew/install/master/install ) 安裝node.js :到官網 http://nodejs.org 下載Mac的pkg安裝包
3.2.2 Appium安裝過程
-
安裝brew :終端輸入ruby –e "$(curl –fsSLhttps://raw.githubusercontent.com/Homebrew/install/master/install)"
-
安裝node.js:到官網http://nodejs.org下載Mac的pkg安裝包,下載完成直接安裝即可無需配置任何參數。在終端輸入node –version 如有版本號出來這說明成功。(也可以通過brew、來安裝:brew install node)
-
獲取權限:sudo chmod –R 777 /usr/local/
-
安裝ideviceinstaller:brew update ,brew install ideviceinstaller
-
安裝Appium服務端:npm install –g appium@1.4.16,npm install wd(還有問題就看這篇文章:www.15yan.com/story/4GbuTwXQKDU/)
-
安裝pip:sudo easy_install pip就行。
-
安裝appium python client和selenium(客服端):pip install Appium-Python-Client,pip install selenium
過程和Windows基本一致,JDK安裝過程自行百度,python咋Mac和
Linux環境下是自帶的無須安裝。環境變量JAVE_HOME和ANDROID_HOME設置,并把ADT里的platform-tools和tools加到系統目錄:
最后,啟動Appium-doctor檢查環境配置,全部打勾說明環境搭建完畢:
3.2.3 針對iOS10升級appium到1.6.3解決方案
由于iOS10放棄了uiautomator,改用XCUITest來進行測試。appium1.6.0之前的版本全部采用uiautomator來進行自動化測試,基于這次iOS的調整,appium1.6.0之后的版本添加了WebDriverAgent依賴來應對這次iOS的調整。這里,我針對appium1.6.3的升級過程做描述。
-
安裝carthage,brew install carthage
-
安裝xcpretty,gem install xcpretty
-
在安裝好appium舊版情況下,卸載appium。npm uninstall –g appium.
-
安裝appium1.6.3,npm install –g appium。(這個過程會很難成功,但是,我們能做的就是不停嘗試,直到安裝成功為止。)
-
安裝WebDriverAgent,cd /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent(如果不在此目錄,自行查找)
-
mkdir –p Resources/WebDriverAgent.bundle
-
sh ./Scripts/bootstrap.sh –d(這步可能會報錯,去下一個vpn,開啟服務,再次下載就ok了,這里推薦“star vpn”很不錯的vpn)
-
cd /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent用xcode打開WebDriverAgent.xcodeproj。修改項目的Bundle identifier.要包Bundle identifier的Facebook改成其他東西。Signing,要選Automatically manage signing,開發者選自己的賬號或者用證書進行編譯,項目的所有bundle identifier都要該。改完后, build。
-
關閉xcode,在終端cd /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent。
-
xcodebuild –project WebDriverAgent.xcodeproj –scheme WebDriverAgentRunner –destination 'id=真機的udid' test.
-
如果運行結果報錯為“Test target WebDriverAgentRunnerencounted an error (Early unexpected exit,operationnever finished bootstrapping –no restart will be attempted)”則忽略不計。
-
到此升級工作完成,注意:在安裝WebDriverAgent到手機的時候必須保持手機連接外網。當然,在使用的過程中同樣要連接外網。(如果WedDriverAgent是用證書進行編譯的則在使用過程中不用連接外網)
-
由于,appium1.6.3為推出GUI版本,這里做元素定位的時候,我們用macaca進行定位,macaca安裝教程網上查詢。
-
app-inspector是macaca的元素定位工具,使用命令,在終端輸入:app-inspector –u "設備的udid"
3.3 Linux版安裝
3.3.1 軟件列表
Linux Ubuntu Destop 14.04以上版本
brew
ruby
git
curl
node
jdk
appium
Android sdk
Python Appium客戶端:Appium-Python-Client、Selenium
3.3.2 安裝過程
Appium Server 的安裝
【參考
https://coderwall.com/p/rcvkrq/install-nodejs-using-homebrew-and-install-appium
原文轉自:http://www.cnblogs.com/baconLiu/p/6735441.html