Appium - Android App Spinner Value Selection Example

Spinner Is a drop down In android software native app where you can select Item from the drop down list as per your requirement. Spinner can have scroll If list Is large and also It can have scroll If there are only few Items In drop down list. Appium software automation tool support scrollTo function to scroll at your desired Item. In this example, We will learn how to scroll down In spinner list Items of android software app and then how to select Item from spinner list using appium software automation test.

App Used For Android Spinner Test
We have to use API Demos android software app for this test and you can downloading API Demos android software app from HERE. You need to Install API Demos app In your android device.

Aim To Active In Spinner Test
We wants to scroll down In Planet spinner list and then select Item "Pluto" from the list as shown In bellow Image. Earlier we already learnt how to scroll down using scrollTo() method In THIS EXAMPLE. We will use same method here to scroll down In spinner list.

Manually you can navigate to above screen from API Demos software app -> Tap on Views -> And then tap on Spinner.

Create And Run Appium Test For Spinner
Create new test file under Android package of project In eclipse and write bellow given android appium test script In It.
package Android;

import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class Spinner {
 AndroidDriver driver; 

 public void setUp() throws Exception {
  DesiredCapabilities capabilities = new DesiredCapabilities();
  capabilities.setCapability("deviceName", "ZX1B32FFXF");
  capabilities.setCapability("browserName", "Android");
  capabilities.setCapability("platformVersion", "4.4.2");
  capabilities.setCapability("platformName", "Android");
  capabilities.setCapability("appPackage", "");
  driver = new AndroidDriver(new URL(""), capabilities);
  driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);

 public void selectPlanetValue() {
  // Scroll till element which contains "Views" text.
  // Click on Views.
  // Scroll till element which contains "Spinner" text.
  // Click on element which contains "Spinner" text.
  //Find parent element of Planet drop down to uniquely Identify It's child drop down.
  WebElement ele = driver.findElementById("");
  //Click on Planet drop down to open drop down list.
  // Scroll till element which contains "Pluto" text In drop down list.
  //Select "Pluto" from drop down list Items.

 public void End() {

Spinner Test Description
Spinner software automation test Is very simple and straight to understand If you have read my all previous android appium examples. When you run above test In eclipse,
  • First It will navigate to Spinners screen.
  • Then locate parent of Planet spinner.
  • Using parent reference, It will locate planet spinner and click on It.
  • Then It will scroll down In spinner list
  • And select "Pluto" from list.
This Is the way to handle spinner In android appium test.


  1. Hi Aravind ,
    How to identify the Toast Messages in Android Device.

  2. Hi Aravind,

    How can we identify the Toast Messages in Android Device.

  3. Toast messages are not supported by Appium it seems

  4. Hi,

    I am having problem while selecting the value from the drop down list. I am trying the above code but it is not working.

  5. In my Apps no spinner is used. But I am unable to find elements for list view . Can anyone please help me to find out and select the particular value from the drop down?

  6. findElementByName is depreacted