appium安装apk包,返回package、activity
作者:互联网
from appium import webdriver def get_app_info(apk): """
dinghanhua 2022-09
:param apk_path: apk路径,不要包含中文 :return: package,activity """ desired_caps = dict() desired_caps['platformName'] = 'Android' # 安卓 desired_caps['platformVersion'] = '7' # 版本 desired_caps['deviceName'] = 'Android7' desired_caps['app'] = apk # 路径 desired_caps['noReset'] = True # 保留数据 driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) # appium 安装apk package = driver.current_package # 获取package activity = driver.current_activity # 获取activity return package, activity apk = r"D:\test_app.apk" print(get_app_info(apk))
标签:appium,desired,app,package,caps,apk,activity 来源: https://www.cnblogs.com/dinghanhua/p/16662607.html