1. Install node.js
- Download for Windows (x64)
- https://nodejs.org/en/
- cmd -> node -v and the correct version number appears
2. Install and configure JDK
3. Install and configure SDK
4. Install appium
Official website: http://appium.io/ , the version of the article: v1.15.1 (different versions, some configurations are different)
5. Install appium-doctor to check whether the dependencies are complete
- npm install -g cnpm --registry=https://registry.npm.taobao.org #Domestic mirror installation
- cnpm install -g appium-doctor #Install appium-doctor by cnpm command
- appium-doctor #View the environment configuration of appium
- Note: The first 8 items must be installed, and Diagnostic for necessary dependencies completed, no fix needed is displayed here.
6. Start appium
7. Keep appium started and run demo
from selenium import webdriver
desired_caps = {
"platformName": "Android",
"platformVersion": "6.0.1",
"deviceName": "123b6e487cf3",
"appPackage": "com.tencent.qqlivekid", # 小企鹅乐园 用于测试
"appActivity": "com.tencent.qqlivekid.activity.WelcomeActivity",
"unicodeKeyboard": True,
"resetKeyboard": True
}
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) # 启动app
driver.quit()
8. Parameter acquisition
版本号:cmd->adb shell getprop ro.build.version.release
Device name: cmd->adb devices
Get appPackage|appActivity: cmd->adb shell dumpsys window | findstr mCurrentFocus (when running the application, run this command)