appium+python+android+ios APP自動化測試環境搭建
阿新 • • 發佈:2019-01-29
一. 安裝brew
sudo chmod -R g+w /usr/localruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
二. 安裝python3.5.3
1.安裝pyenv
brew updatebrew install pyenv
然後在 .bash_profile 檔案中新增
eval “$(pyenv init -)”
如果沒有.bash_profile的檔案。就自己在目錄下建立一個
vi .bash_profile
eval "$(pyenv init -)"
:wq
source .bash_profile
2.安裝python3.5.3
* 使用 pyenv 安裝 python 3: pyenv install 3.5.3 -v
* 安裝完成後,更新資料庫: pyenv rehash
檢視目前系統已安裝的 Python 版本
$pyenv versions
* system (set by /Users/iglucouser/.pyenv/version)
3.5.3
* 表示系統當前正在使用的版本
3.切換 Python 版本
pyenv global 3.5.3檢視目前系統 Python 版本
$ pyenv versions
system
\* 3.5.3 (set by /Users/iglucouser/.pyenv/version)
執行 Python,確認 Python 版本
$ python
Python 3.5.3 (default, Jan 25 2018, 15:31:09)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
三、安裝Xcode
app store下載即可
四、下載android-sdk
連結:https://pan.baidu.com/s/1mFNkEIwhDpCKvDvr-0IFUQ 密碼:um7z配置環境變數
open .bash_profile
新增
# Setting PATH for android-sdk
export ANDROID_HOME=/Users/iglucouser/Applications/android-sdk-macosx(android-sdk存放的目錄)
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
export PATH=${PATH}:${ANDROID_HOME}/tools
# Setting PATH for apt
AAPT_HOME=${ANDROID_HOME}/build-tools/26.0.2
export AAPT_HOME
export PATH=$PATH:$AAPT_HOME
五、安裝appium環境
1.安裝node: brew install node2.安裝cnpm: npm install -g cnpm
3.安裝appium-doctor: cnpm install -g appium-doctor
出現全✅才OK
4.安裝app-inspector: cnpm install -g app-inspector
5.安裝ios-deploy: cnpm install -g ios-deploy
6.安裝appium-uiautomator2-driver: cnpm install -g appium-uiautomator2-driver
7.安裝appium:cnpm install -g appium
六、webdriveragent
1.到WebDriverAgent下載最新版本的WebDriverAgent2.進入下載後的WebDriverAgent檔案
3.執行 ./Scripts/bootstrap.sh
4.直接用Xcode開啟WebDriverAgent.xcodepro檔案
5.配置WebDriverAgentLib和WebDriverAgentRunner的證書
6.連線並選擇自己的iOS裝置,然後按Cmd+U,或是點選Product->Test
7.執行成功時,在Xcode控制檯應該可以打印出一個Ip地址和埠號
8.進入到Appium中的WebDriverAgent目錄,目錄路徑如下(/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/)
9.將自己下載並編譯後的WebDriverAgent替換Appium原有的WebDriverAgent
七、安裝appium-desktop
連結:https://pan.baidu.com/s/11PJLBb5OeltkYVuKfqNqKg 密碼:32c6
八、安裝pycharm
https://www.jetbrains.com/pycharm/download/#section=mac
九、安裝其他相關包
pip install Appium-Python-Clientpip install selenium
pip install configparser
pip install pyyaml
pip install schematics
brew install --HEAD libimobiledevice
brew link --overwrite libimobiledevice
brew install ideviceinstaller
brew link --overwrite ideviceinstaller