1.安装appium
下载地址 : https://github.com/appium/appium-desktop
2.安装 appium python库
pip install Appium-Python-Client
pip install Appium-UIAutomation
3.连接手机
- 通过USB直接连接
- 通过wifi 连接
adb tcpip 5555 adb connect 192.168.1.106:5555
adb devices
4.启动appium
5.连接测试
from appium import webdriver desired_caps = { ‘platformName‘: ‘Android‘, #‘deviceName‘: ‘A7Q*********‘, 设备号连接 ‘deviceName‘:‘192.168.1.106:5555‘,#IP:端口号 连接 #‘platformVersion‘: ‘8.0‘, # apk包名 ‘appPackage‘: ‘com.meizu.flyme.flymebbs‘, # apk的launcherActivity ‘appActivity‘: ‘com.meizu.flyme.flymebbs.home.MzbbsActivity‘ } driver = webdriver.Remote(‘http://127.0.0.1:4723/wd/hub‘, desired_caps)