Validating toast popups on android

Mobile Testing, Android App Testing.
Mozzytm
Posts: 36
Joined: Fri Feb 08, 2013 11:18 am

Validating toast popups on android

Post by Mozzytm » Fri Feb 08, 2013 11:21 am

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

Mozzytm
Posts: 36
Joined: Fri Feb 08, 2013 11:18 am

Re: Validating toast popups on android

Post by Mozzytm » Fri Feb 08, 2013 4:56 pm

Never mind, sorted it. Was on the list all the time just not where I expected it to be.

M

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Validating toast popups on android

Post by Support Team » Mon Feb 11, 2013 12:23 pm

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
.
Image

User avatar
sandamal
Posts: 28
Joined: Wed Jul 08, 2015 7:50 am

Re: Validating toast popups on android

Post by sandamal » Thu Jul 23, 2015 8:12 am

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 ?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Validating toast popups on android

Post by odklizec » Thu Jul 23, 2015 8:32 am

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).
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

User avatar
sandamal
Posts: 28
Joined: Wed Jul 08, 2015 7:50 am

Re: Validating toast popups on android

Post by sandamal » Tue Sep 01, 2015 12:17 pm

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.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Validating toast popups on android

Post by odklizec » Tue Sep 01, 2015 12:28 pm

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.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

lucian.teodorescu
Posts: 82
Joined: Fri Oct 24, 2014 10:58 am
Location: Bucharest

Re: Validating toast popups on android

Post by lucian.teodorescu » Tue Sep 01, 2015 2:13 pm

Hi Pavel,

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

Regards,
Lucian Teodorescu
NetSun Software

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Validating toast popups on android

Post by odklizec » Tue Sep 01, 2015 2:39 pm

You are probably right ;) I somehow missed it's about "android" popups ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Validating toast popups on android

Post by Support Team » Wed Sep 02, 2015 3:52 pm

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
.
Image