Automated testing is a necessary skill for testers. The so-called automation is to complete manual operations through code. Today I will summarize how to start the app through python
Environmental conditions
1. Install python: download address
2. Install JDK: download address
3. Install Android-SDK: For details, see appium—Android-SDK installation
4. Install appium: For details, see appium—command line to start appium, and the method of installing the client is not unified, the client download link; Note: If the Android version is above 7.0, please install appium version 1.7 or above
5. Install Node.js: download link
6. Install Appium-Python-Client
# Install appium using pip
pip install Appium-Python-Client
Start conditions
To start the app through code, you need to know the package name and launcherActivity of the app< /p>
Method 1:
# View the package name through aapt, Activity
aapt dump badging apk path
aapt is the abbreviation of Android Asset Packaging Tool, a tool for compiling and packaging resources, in the build-tools directory of the SDK. At present, only ppat is used to view the package name and Activity of the apk
Method 2:
# View by adb command
# Click the running app to view the log
adb lagcat |find "START"
Code implementation
1.platformName: Test version (IOS/Android)
< p>2.deviceName: the name of the mobile phone device, viewed through adb devices
3.platformVersion: Android version number
4.appPackage: apk package name
5 .appActivity: launcherActivity of apk
127.0.0.1:4723/wb/hub: local address + appium port number;appium port number is OK Change
6. Start appium
Open cmd, enter appium start command line
7. Start the app
After running the code , You will find that the software on the phone is activated
# Install appium using pip
pip install Appium-Python-Client
Method 1:
# View the package name through aapt, Activity
aapt dump badging apk path
aapt is the abbreviation of Android Asset Packaging Tool, a tool for compiling and packaging resources, in the build-tools directory of the SDK. Currently only ppat is used to view the package name and Activity of the apk
Method 2:
# View by adb command
# Click the running app to view the log
adb lagcat |find "START"