How to accept Alert pop-ups in Android using JAVA???

668 views
Skip to first unread message

yogeesh babu

unread,
Apr 8, 2014, 11:10:41 AM4/8/14
to appium-...@googlegroups.com
Hi all,
 
I was trying to automate inbuilt app. After doing some operation device will pop up balance alert info from network. As this popup is not consistent, i was not able to find that element in the flow.
 
There are two questions here.
 
1. Is it possible to declare all(which ever required) elements instead of finding elements when device disaplays.
2. I'm using code below to click on OK(Alert msg from network)
 

WebElement ok =

driver.findElement(By.name("OK"));

if (ok.isDisplayed()){

ok.click();}

Problem here is sometimes Alert message wont display and Test script fails. Is there any way to accept all alerts pop ups using JAVA?

Thanks in advance..:)

Regards,

Yogeesh

 

 

 

 

bootstrap online

unread,
Apr 8, 2014, 11:25:40 AM4/8/14
to yogeesh babu, appium-...@googlegroups.com
It's problematic to have random popups on Android. The solution when
using uiautomator is to create a UiWatcher. Appium doesn't currently
allow custom watchers though.

https://github.com/appium/appium/blob/master/lib/devices/android/bootstrap/src/com/android/uiautomator/common/UiWatchers.java
> --
> http://appium.io
> ---
> You received this message because you are subscribed to the Google Groups
> "Appium-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to appium-discus...@googlegroups.com.
> Visit this group at http://groups.google.com/group/appium-discuss.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages