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

zhangzhao_lenovo · April 10, 2015 · Last by zhangzhao_lenovo replied at December 07, 2016 · 1154 hits

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
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去做验证?

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

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

陈恒捷 [Topic was deleted] 中提及了此贴 30 Jun 20:27
陈恒捷 探究如何获取界面出现的 toast 中提及了此贴 05 Nov 02:32
需要 Sign In 后方可回复, 如果你还没有账号请点击这里 Sign Up