Unable to select android spinner item

Hi,

Can someone please help me with selecting spinner item in android.

I have checked with the previous discussion in this forum regarding spinner but those doesn’t seem to help.

I am using appium 1.5.3.

Any leads are appreciated.

Regards,
Sujin

try this:

public void testExample(){
WebElement spinner=driver.findElement(By.id(“android:id/text1”));
spinner.click();
driver.scrollToExact(“India”);
WebElement optionIndia=driver.findElement(By.name(“India”));
optionIndia.click();
}

Tried but it shows the following Exception

InvalidSelectorException: Locator Strategy ‘name’ is not supported for this session

Tried but it shows the following Exception

InvalidSelectorException: Locator Strategy ‘name’ is not supported for this session

we do it in following way:
1 - check current value of spin
2 - depending if it more or less scroll spin to needed direction
3 - repeat 1+2

use xpath or id instead of name

How can I give id for spinner items which is dynamic?

Is your app available on play store, if yes then tell me the may be I’ll corss check from my side

Sorry its not yet released. Its just a simple spinner in which I will select the country.

With the older version of appium By.name works but with the latest version 1.5.3 its not working. And I am looking for an alternate and I have some other dependencies due to which I cannot switch to the older version

Try using findElementByAndroidUIAutomator
Eg:
driver.findElementByAndroidUIAutomator(“new UiSelector().text(“India”)”).click();