appium+python 快速给真机安装app

#coding=utf-8
from appium import webdriver
from time import sleep
import os,time,unittest

'''给手机快速装app的方法'''

PATH=lambda p :os.path.abspath(os.path.join(os.path.dirname(__file__),p))

desired_caps ={}
desired_caps['device'] = 'android' #系统
desired_caps['platformName'] = 'Android'
desired_caps['version'] = '4.1.1' #系统版本
desired_caps['deviceName'] = 'HTC S720t' #机器型号
desired_caps['automationName'] = 'selendroid' #版本小于4.2.2(api17)都需要指定selendroid
#desired_caps['app'] = PATH('D:\jinritoutiao_545.apk')
desired_caps['app'] = PATH('D:\weixin_780.apk') #被测试app在电脑上的位置

dr = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)

sleep(5)
dr.quit()
原文地址:https://www.cnblogs.com/liuchunxiao83/p/5490123.html