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))

 

posted @ 2022-09-06 17:24  dinghanhua  阅读(125)  评论(0编辑  收藏  举报