Unable to select android spinner item


#1

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


#2

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();
}


#3

Tried but it shows the following Exception

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


#5

Tried but it shows the following Exception

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


#6

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


#7

use xpath or id instead of name


#8

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


#9

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


#10

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


#11

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