Unable to select option from Spinner using Appium 1.6

I am using Appium 1.6 to automate Android UI tests.

In this image, I cannot select any country (ex: Japan) from the counter.

screenshot

This is the code I am using:

driver.findElement(By.id("com.akkipet.android:id/country_spinner__add_information")).click();    
driver.findElement(MobileBy.AndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView("+ "new UiSelector().text(\"India\"));")).click()

      

What am I doing wrong? After clicking on the spinner, although I cannot read the country values, I can read other fields like first name, last name, etc.

I am currently using the tap function to click on specific coordinates to select the option I want. But this will make it device specific. Also, since the list of options changes depending on the environment, I will have to provide a different set of coordinates for each environment.

Code for Tap:

touchAction.tap (200, 850).perform();

      

Can anyone suggest a better workaround?

+3


source to share


1 answer


Try it. This worked for me. driver.findElement(By.id("com.akkipet.android:id/country_spinner__add_information")).click();
driver.findElement(By.name("India")).click();




0


source







All Articles