Build python+Appium+xcode+android studio automated test environment

Table of contents

1. The required environment

Two, install python

3. Install pycharm

4. Install android studio (android sdk)

5. Install xcode

6. Install Appium

1. Install Appium from the command line

2. Install dependencies

3. Problems encountered:

4. Start appium


1. The required environment

python-3.9.6

pycharm

android studio(android sdk)-2022.1.1

xcode-14.2

Appium (Appium-Python-Client-2.8.1)

Two, install python

Official website: Welcome to Python.org

After opening, follow the installation wizard to install step by step.

Configure environment variables in .bash_profile,

export PATH="/Library/Frameworks/Python.framework/Versions/3.11/bin:${PATH}"
alias python="/Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11"

Save and exit, source .bash_profile to make the environment variable take effect.

我的电脑上系统比较新,内置的python是python3.9,自己下载了python3.11;
自行安装Python路径为:/Library/Frameworks/Python.framework/Versions/
系统命令默认路径/usr/bin(系统预装的可执行文件,随系统升级而变化)
用户命令默认路径/usr/local/bin(用户安装的可执行文件,不随系统升级影响)

qa@QAdeMacBook-Pro ~ % where python3
/usr/local/bin/python3
/usr/bin/python3
qa@QAdeMacBook-Pro ~ % python3 -V
Python 3.9.6

这里没有进行配置环境变量,所以版本是3.9,如果配置了环境变量,再查版本,会显示配置了环境变量的版本。

3. Install pycharm

Download and install from the official website.

4. Install android studio (android sdk)

Refer to (2023) mac to install Android studio (including installing jdk, Android SDK)_Vermouth_00's Blog-CSDN Blog

5. Install xcode

It takes a long time to search directly in the app store.

 Just click install; after opening xcode, you need to log in to the apple id.

6. Install Appium

Appium desktop, Appium server, Appium-Python-Client.

Appium Server runs on nodejs and is developed based on js. appium desktop is a GUI tool, including nodejs operating environment, Appium Server and client.

1. Install Appium from the command line

Install Appium-Python-Client:

pip3 install Appium-Python-Client

Install Appium Server:

npm install -g appium
#或者
npm install appium -g --chromedriver_cdnurl=http://cdn.npm.taobao.org/dist/chromedriver

2. Install dependencies

Install homebrew first, then brew installs dependencies;

#安装homebrew
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
brew install libimobiledevice #使用本机与苹果iOS设备的服务进行通信的库。
brew install ideviceinstaller #获取设备udid、安装app、卸载app、获取bundleid
brew install carthage #第三方库管理工具。
brew install ios-deploy #不依赖于XCODE,进行安装和调试IOS应用程序。
brew install nvm #使用nvm来安装node,方便对node版本进行管理
nvm install v8.14.0
brew install npm
npm install -g appium-doctor

Finally, use the appium-doctor command to check what dependencies are missing, and install them accordingly.

3. Problems encountered:

(1) An error is reported when brew installs libimobiledevice: Error: Command failed with exit 128: git

brew -v

Execute the command according to the prompt:

git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask

 Then execute the installation command again, and the installation is successful.

(2) nvm configuration environment variables

#环境变量内容:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
#然后再终端输入以下命令:
echo "source $(brew --prefix nvm)/nvm.sh" >> .bash_profile
#最后
. ~/.bash_profile

4. Start appium

appium

Guess you like

Origin blog.csdn.net/Vermouth_00/article/details/129082822