How to capture toast message

I am currently working on app which needs it’s testing to be automated

I am not able to capture text from toast messages, does, anyone have an idea how to do that ?

1 Like

Hey @Ishan_Shelke1

Could you please show us a snap to understand what is a toast message ?



Kindly see above image

1 Like

So you want to capture that from a web app ?


No from a Mobile App

1 Like

Oops you are doing a mobile automation then ?

I’m not sure this is possible in an easy way or at all. I suspect that the toast doesn’t stay very much on the screen so it is hard to get a selector at design time. There are some tricks to keep it longer on the screen by slowing animations down, on the emulator but then at runtime it might slip between two queries, so it’s not found.

In my past dealings with toast messages, when a toast appeared there was an entry in the adb log as well. So one strategy was to issue the action and after a timeout when I was sure that the toast was shown, I got the logs and search in them to verify that the toast appeared or not. I don’t know what you want to do with the toast, but this might be a workaround to try.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.