1、环境配置
需要确保appium版本在1.6.3及以上
2、需要添加代码
3、toast的内容
4、编码
# # 定位toast
toast = (By.XPATH, "//*[contains(@text, '{}')]".format('登录成功'))
a = self.find_element(*toast)
# 获取toast的文本值
context = a.text
print("toast的文本值为", context)
5、结果