1、获取当前activity
from appium import webdriver
desired_caps = {
'platformName' : 'Android',
'platformVersion' : '6.0',
'deviceName' : '127.0.0.1:62001',
'appPackage' : 'com.android.settings',
'appActivity' : 'com.android.settings.Settings',
'noReset' : 'False',
}
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
activity = driver.current_activity
print(activity) # .Settings
2、等待activity出现
from appium import webdriver
desired_caps = {
'platformName' : 'Android',
'platformVersion' : '6.0',
'deviceName' : '127.0.0.1:62001',
'appPackage' : 'com.android.settings',
'appActivity' : 'com.android.settings.Settings',
'noReset' : 'False',
}
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
driver.find_element_by_xpath('//*[@text="双卡和网络"]').click()
driver.wait_activity(".Settings", 10)
Words
Appium、appium + android、获取当前activity、等待activity出现
欢迎评论补充
Blog:
- 简书:https://www.jianshu.com/u/ec81abf35751
- CSDN:https://blog.csdn.net/qq_21238607
- 微信公众号:rzbbzr
网友评论