Unable to scroll and select the elements in the date picker

Hi Team,

Could you please help how to write the code for the below scrollable in the appium using java.

I am testing in the android simulator

You can do it with scrolling and coordinates but that is a lot of overhead.

Try the following:

List<WebElement> datePickerBox = driver.findElements(By.xpath("//*[@class='android.widget.EditText']"));

WebElement month = datePickerBox.get(0);
WebElement day = datePickerBox.get(1);
WebElement year = datePickerBox.get(2);

month.click();
month.sendKeys("Feb");

day.click();
day.sendKeys("22");

year.click();
year.sendKeys("2018");

Hi I had used your code but it was not working actually here it need to scroll to the particular element

final By calDob=By.id(“dob_tv”);
final By calMonthPicker=By.xpath("//android.widget.NumberPicker[@index=‘0’]");
final By calDayPicker=By.xpath("//android.widget.NumberPicker[@index=‘1’]");
final By calYearPicker=By.xpath("//android.widget.NumberPicker[@index=‘2’]");

use the above xpaths and send the required date using sendkeys in the locators.

here i am sending only year.

click(calDob,TimeEntity.SEC_5.getSeconds());
int year = Calendar.getInstance().get(Calendar.YEAR);
int pastDateYear = (year - 30);
MobileElement calYear= findElement(calYearPicker);
TimeManager.waitInSeconds(2);
clearAndType(Integer.toString(pastDateYear), calYear);
click(calBtn,TimeEntity.SEC_2.getSeconds());

Hi sendKeys() not entering or selecting the date. Is there any solution available to select a date?

Hi Did you find a solution for this? I am facing the same issue where sendKeys() is not selecting a date.

I am also looking for solutions to this.