How to validate the alert messages that are displayed for a short period and then disappear

I was unable to get the alert messages like “Profile data updated successfully” like messages that will appear for short period. Even I was unable to detect those messages using UI automator . Can anyone please help me on this.

These are called Toast messages
They cannot be automated using appium
But if u run selendroid mode of appium you can automate them using
driver.findElement(By.partiallinkText(“toast mrssage”)).is size() >0

1 Like

Hi Amit,

Thanks for your reply.
As per I know selendroid mode is applicable for the API <17 . Is it possible to use selendroid mode for API >18 and Appium Version 1.4.0.0

If possible please explain me in detail how to use selendroid mode.

Here is misconception about selendroid… Let me explain… Appium uses its default instrumentation as UIAutomator which is bundled by your android SDK. UIAutomator only works devices above API >17, so devices which has API version < 17 which were not instrumented by UIAutomator. So Appium’s default instrument was not working device’s below 17.
So second this, Selendroid is independent way of instrumentation which supports device >API 10. So appium’s dev team has included Selendroid instrumentation also so they can cover most of device spectrum.
So even in marshmellow you can still run your test in selendroid mode. Its only choosing different way of instrumentation nothing else.

Thanks,
Priyank Shah

@Priyank_Shah
Thanks for such a nice explanation

@Kiran

Yes it should will work. As explained above very nicely. To use selendroid mode you have to use capability while creating session as
“automationName”, “Selendroid”

Selendroid supports
Android 2.3.3 ( GINGERBREAD_MR1) to Android 4.4 ( KITKAT)
API level 10 to API level 19

So you can try in a KITKAT android version device it will work. Actually I personally tried with API level 19 device and selendroid worked fine.

For using selendroid inspector after starting appium server in selendroid mode go to below url. It will inspect current app page displayed in connected device
localhost:8080/inspector/session/88ce8684-d785-4a24-9157-80967becc60d/

Summary : Selendroid supports API level 10 to 19 but appium uses it for 10 < API level < 17 as framework they use is developed using API level 17 onwards…

Which is better instrumentation Selendroid or UIAutomator? Which one shall we use? Can we switch instrumentation at run time?

I dont think you can switch mode at run time.

You need to specifiy the mode you use when creating appium session.