Appium(2) 跳转到其他应用以及获取跳转应用的包名和界面名


from appium import webdriver
from appium.webdriver.extensions.android.nativekey import AndroidKey
import time

desired_caps = {
'platformName': 'Android', # 被测手机是安卓
'platformVersion': '8', # 手机安卓版本
'deviceName': '123', # 设备名,安卓手机可以随意填写
'appPackage': 'com.android.settings', # 启动APP Package名称
'appActivity': '.HWSettings', # 启动Activity名称
'unicodeKeyboard': True, # 使用自带输入法,输入中文时填True
'resetKeyboard': True, # 执行完程序恢复原来输入法
'noReset': True, # 不要重置App
'newCommandTimeout': 6000,
'automationName' : 'UiAutomator2'
# 'app': r'd:\apk\bili.apk',
}
# 连接Appium Server,初始化自动化环境
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)

time.sleep(3)
#跳转其他APP
driver.start_activity("com.android.mms",".ui.ConversationList")

print(driver.current_package)
print(driver.current_activity)



 

posted @ 2020-03-26 21:29  反着来就对了  阅读(817)  评论(0编辑  收藏  举报