Download Python 3
https://www.python.org/downloads/mac-osx/
Modify environment variables
Modify ~ /. Under the user root directory bash_profile file, input at the terminal:
vi ~/.bash_profile
Add a new row
PATH="/Library/Frameworks/Python.framework/Versions/3.9/bin:${PATH}" export PATH alias python="/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9"
Press: wq after saving, the terminal will input
source ~/.bash_profile
This is not enough. After restarting the terminal, it will return to 2.7. The following steps are required
-New zshrc file
Command line input:
vim ~/.zshrc
Add a row
source ~/.bash_profile
Execute command
source ~/.zshrc
Install jdk
Download java8
The Java home directory is:
/Library/Java/JavaVirtualMachines/jdk1.8.0_311.jdk/Contents/Home
Configure environment variables
vi ~/.bash_profile
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_311.jdk/Contents/Home PATH=$JAVA_HOME/bin:$PATH:. CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:. export JAVA_HOME export PATH export CLASSPATH
Press: wq after saving, the terminal will input
source ~/.bash_profile
Install SDK
Because my Mac Book Pro is an M1 chip, I need to use Android studio to install sdk
After the installation is complete, configure the environment variables
Can be configured in In the zshrc file
sudo open ~/.zshrc
# Android SDK export ANDROID_HOME=/Users/belin/Library/Android/sdk export PATH=${PATH}:${ANDROID_HOME}/platform-tools export PATH=${PATH}:${ANDROID_HOME}/tools export PATH=${PATH}:${ANDROID_HOME}/platforms export PATH=${PATH}:${ANDROID_HOME}/build-tools/32.0.0
Command line input
source ~/.zshrc
List of environmental variables:
.bash_profile
.zshrc
So far, Android app automation testing can be done after appium is installed, but the good play has just begun, followed by the most difficult ios automation environment configuration
ios environment depends on installation
Install HomeBrew
Terminal input
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
Installing nodejs
Terminal input command
brew install node
Install npm
Terminal input command
npm install -g cnpm --registry=https://registry.npm.taobao.org
Install libimobiledevice
This is a library for native communication with Apple device services
Terminal input command
brew install libimobiledevice
Install # ideviceinstaller
User obtains udid bundleid, installs app, uninstalls app
Terminal input command
brew install ideviceinstaller
brew install ios-deploy
Installing carthage
Third party management tools
Terminal input command
brew install carthage
Install IOS deploy
Systems above iOS10 need to be installed
brew install ios-deploy
Install wd
npm install wd
Install usbmuxd
Connect your phone and computer using iproxy
Terminal input command
brew install usbmusd
Install appium doctor
npm install -g appium-doctor
appium environment validation
Terminal input command
appium-doctor --android/ios
Android environment
ios environment
Install appium GUI version
Appium: Mobile App Automation Made Awesome.
Download the latest version 1.22.0 or above, otherwise you will not be able to connect to WDA
Install Xcode
Download the latest version from the App Store
Configure WebDriverAngent
This step is the most complex. The online methods are relatively old. I have tried a lot, but I can't connect to WDA
-First, find the appium webdriver agent folder under the appium installation directory, and its path is
Then open the file in the folder
-Configure WDA
-Select items and equipment
Choose to use emulators or other ios devices such as mobile phones
-Select developer account
Just enter your Apple ID
-Modify module name
Now that the configuration is complete, start installing wda on the device
-Build program
- Test Procedure
When connecting the mobile phone, a certificate trust error will appear. You need to trust the certificate in device settings - > General - > VPN and device management
At this time, the mobile phone screen will have a gray mask, and there will be an application without icon
So far, we have been able to realize the automatic test of ios simulator
-Open appium and inspector
When using the simulator to connect, you need to add / wd/hub to the remote path
You can then create a session to find the element
If you need to connect your mobile phone, you need the following steps
Terminal input command
iproxy 4723 8100
Then connect the phone
Open the inspector
When using the mobile phone, the remote path must be set to /, and the udid must be configured
So far, the ios automated testing environment has been completely built
Then you can write scripts for automated tests
Install pycharm
PyCharm: the Python IDE for Professional Developers by JetBrains
ideviceinstaller command
Android like adb command
-Get the app information of the device
ideviceinstaller -l
-List all devices, including real machine, mac and simulator
instruments -s devices
-Get the udid of the connected device
idevice_id -l
-Install ipa package to device
ideviceinstaller -i xx.ipa
Element positioning tool
-Inspector tool provided by Appium
-Xcode's built-in accessibility inspector tool