Page 1 of 1

Validating toast popups on android

Posted: Fri Feb 08, 2013 11:21 am
by Mozzytm
Hi there,

Can someone tell me if this is possible? I have automated to the point where the toast appears and then attempted to validate but the toast message does not appear in the structure. I have also tried adding a new action with the intent of doing some form of text compare manually but there is no obvious function to add to grab toasts.

Any help appreciated

Cheers

M

Re: Validating toast popups on android

Posted: Fri Feb 08, 2013 4:56 pm
by Mozzytm
Never mind, sorted it. Was on the list all the time just not where I expected it to be.

M

Re: Validating toast popups on android

Posted: Mon Feb 11, 2013 12:23 pm
by Support Team
Hi,

In most case you could use a generic element like
/mobileapp[@title='yourAppTitle']//text[@caption~'ToastCaption]
Just put this element to your repository and then you can use it for validation.

Regards,
Peter
Ranorex Team

Re: Validating toast popups on android

Posted: Thu Jul 23, 2015 8:12 am
by sandamal
Hi,

Im facing the same issue and add a new eliment like

\mobileapp[@title='no.app.dev']//text[@caption~'Username or Password is incorrect.']

and I add the validation Like :
Action - Validate
Device Display name : AttributeContains
Match Name: Caption
Match Value : Username of Password is incorrect.

and it fails to find the toast in test run, can you please explain how can I use the validation ?

Re: Validating toast popups on android

Posted: Thu Jul 23, 2015 8:32 am
by odklizec
Hi,

Are you sure the validated string is exactly like this?
Could you please create and post Ranorex snapshot of your Android app with displayed popup message?
Also, what's your Ranorex version (latest is 5.4).

Re: Validating toast popups on android

Posted: Tue Sep 01, 2015 12:17 pm
by sandamal
Hi this is to inform How I resolve the problem,

main issue was getting the correct "Path" for the toast.

to catch the toast in to ranorex spy you need to save the snap shot at the moment when toast is visible.

1) so navigate to toast event triggering window in android application
2) open ranorex spy -> right click -> save as snapshot -> give a name ( dont click save )
3) now trigger the event which is going to give a toast -> click save button at the moment toast is visible

Open and check the saved .rxsnp file, in the structure you will find a new text message element for that toast. most probably it will lay inside a new container.

Re: Validating toast popups on android

Posted: Tue Sep 01, 2015 12:28 pm
by odklizec
Hi,

Thanks for the heads-up. Have you tried to use Instant Tracking (Ctrl+Left Win shortcut)? It's especially useful for things like popup menus and other dynamically loaded elements.

Re: Validating toast popups on android

Posted: Tue Sep 01, 2015 2:13 pm
by lucian.teodorescu
Hi Pavel,

For the time being, instant tracking is not working on mobile apps.
Do you have a different experience? :o

Regards,

Re: Validating toast popups on android

Posted: Tue Sep 01, 2015 2:39 pm
by odklizec
You are probably right ;) I somehow missed it's about "android" popups ;)

Re: Validating toast popups on android

Posted: Wed Sep 02, 2015 3:52 pm
by Support Team
Hello sandamal,

Are you sure the adapter is text and the property is caption?
If not you can try a RanoreXPath like the following in order to find the element.

\mobileapp[@title='no.app.dev']//*[?'Username or Password is incorrect.']

I hope this helps.

Regards,
Bernhard