How to select value from datepicker in native android app using appium

I’m facing problem in selecting month from calendar because the month feild is non editable sendkeys is not working . with the below code im able to select date and year value but not month

            driver.findElementById("com.policybazaar:id/layout_view").click();
	driver.findElementById("android:id/pickers");
	driver.findElementByXPath("//android.widget.NumberPicker[@index='0']").sendKeys("11");
            driver.findElementByXPath("//android.widget.NumberPicker[@index='1']").sendKeys("Dec");
	driver.findElementByXPath("//android.widget.NumberPicker[@index='2']").sendKeys("1980");

I never managed to do it. I implemented my own script which swipes through the values and compares them to my input.

Thank for reply ,can u please tell me how to swipe to get expected value

As I can see in the inspector, you can find each picker and get its location and size. Once you have that you can implement swipe via. TouchAction (google it) inside this element, just like user do. Ohh… and swipe for the size of each button you have inside that NumberPicker.

Hi @Anshita_Sen… If you are trying to swipe the screen in ANDROID, try this which worked successfully for me.
Dimension size = driver.manage().window().getSize();
int startx = (int) (size.width * 0.70);
int starty = size.height;
int endy = size.height / 2;
int endx = (int) (size.width * 0.30);
driver.swipe(startx, starty, endx, endy, 2000);

And coming to your query, you cannot select ‘Apr’ but you can select ‘May’ and scroll it using the above code with if else till your required element is visible. And as I see the details of the element it’s scrollable too. So I think this works for you.

Did you find any solution for this. I’m facing same issue with number picker. In my case I’m not able to change any of them(day , month and year)

It is possible with espresso driver