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))
当情绪低落,烦躁的时候,学技术并整理成博客能忘却所有烦恼。技术改变心境。