Appium appium issues 4824,提到一例 toast 的解决方案

zhangzhao_lenovo · 2015年04月10日 · 最后由 zhangzhao_lenovo 回复于 2016年12月07日 · 1570 次阅读

https://github.com/appium/appium/issues/4824

yahman72 commented 9 days ago

I decided to open a new issue for this enhancement since the #968 was closed with "closed because Google needs to add this to uiautomator" comment.

IMHO there would be a way to support this by using the Accessiblity Services i.e.
1) implement a ToastRecorder app that catches & records the Toasts (see http://stackoverflow.com/questions/10659734/detecting-toast-messages)
2) include that app in the appium apk's that are installed on the device
3) enhance the Appium API to access the ToastRecorder data

In that stackover thread is a link to an App that is recoding Toasts. Currently I'm using that App to verify Toasts. To support this in Appium would be much better because using an extra app is pretty cumbersome for the verification. Currently I need to do the following:
1) run the tests for my app "normally" with appium
2) After execution start that Toaster App and verify that all expected Toast were recorded.

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
共收到 7 条回复 时间 点赞

赞!
今晚学习内容就这个了!

嗯,这个可以了解下。

意思就是在脚本 run 期间把遇到的 toast 录制下来,后期再用 Toaster App 去做验证?
我觉得下面有个人回复的挺好。appium 确实应该考虑在 bootstrap 内加入 toast 录制功能呐呐~~

#4 楼 @jennyhui 下面回复的那个就是 appium 的主力开发者。他的意思不是加入 toast 录制功能,而是通过这个获取 toast 的方法来实现验证 toast 是否出现。
我可以想到的基本逻辑应该是在 bootstrap 中起个线程执行类似 toaster app 的代码来关注是否有 toast 出现,如果有就记下来。脚本询问是否有 toast 出现及 toast 的相关信息就用记下来的最新的那份数据来做校验。

#5 楼 @chenhengjie123 soga 不懂 我先了解一下 appium 更新快 相信很快就会更新这一块的缺失的

陈恒捷 [該主題已被刪除] 中提及了此贴 06月30日 20:27
陈恒捷 探究如何获取界面出现的 toast 中提及了此贴 11月05日 02:32
需要 登录 後方可回應,如果你還沒有帳號按這裡 注册