Best way to handle Android spinner

I’m testing an Android app and on several pages, an Android spinner (android.widget.ProgressBar) can spin for 1-20 seconds. All of the elements on the page are visible and are enabled, but if I try to click on an element while the spinner is still present, the script fails because the element doesn’t really get clicked. (On these pages there’s user information being downloaded, but not being displayed). The status of the elements on the page don’t change when the spinner finishes, but this Spinner element (id=progress_spinner) is no longer present.

Anybody have a suggestion on how to best handle a situation like this? I guess what needs to be done is wait until the spinner element is no longer present before continuing the script. My setup is:

Appium 1.5.3
Appium java-client 4.1.2
Running on a Mac (10.11.4)

You are looking for an implicit wait:

1 Like


I did below in my script to handle similar situation in case of iOS

  1. Explicit wait of 1 sec for this element to check the presence
  2. Run this in while loop with sleep timer 1 sec for 30 times
  3. Once element is no more visible, you can click on underlying elements

Also use latest appium server and java client version. The one you’re using are really old.

1 Like