toast 介绍
- 简易的消息提示框
- 显示时间有限
- 是一个系统级别的控件,归属于系统 settings
- 当 APP 发送消息时,不是自己造出来的弹框,而是发给系统,由系统统一进行弹框
- 此类空间不在 APP 内,需要特殊的控件识别方法
toast 定位
appium 使用 uiautomator 底层的机制来分析抓取 toast,并把 toast 放到控件树内,但本身并不属于控件
前置工作:设置 capabilities
caps["automationName"] = "uiautomator2" # 默认引擎
使用 xpath 查找
//*[@class="android.widget.Toast"]
//*[contains(@text, "xxxx")]
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。