How can sent the date in a datepicker appium (Android API 19, version


I have a problem in setting the date from a date picker in Appium. I’m trying to set the date by sending keys in the fields in this way:

List<WebElement> pick = driver.findElements(By.className("android.widget.EditText"));           


This works fine in previous versions of API but since I’m testing in a different device now appium seems not to finding my elements correctly. Here is a photo from the inspector window that shows that I’m using the correct class to find the fields.enter image description here

Any ideas?Thanks!!

@Panos Did you find any solution for this problem ?

My app users Google date widget which has same id for month , date and year. ( id: android:id/numberpicker_input )

I tried using send_keys but it’s not working as expected.

If you can please share your solution , it’ll be helpful


@Panos : same question as Vikram -> did you find a solution ?


Hi guys, did you find the solution to this issue? I am using appium and I am not able to set the date.

Not really. But have you try with a swipe ?

haven’t tested it myself. but take a look at this discussion:

Check if this helps

((AndroidElement)(driver.FindElement(By.XPath("//android.widget.NumberPicker[@index='0']//android.widget.Button[@index=0]")))).Tap(1, 2);

((AndroidElement)(driver.FindElement(By.XPath("//android.widget.NumberPicker[@index='1']//android.widget.Button[@index=0]")))).Tap(1, 2);

((AndroidElement)(driver.FindElement(By.XPath("//android.widget.NumberPicker[@index='2']//android.widget.Button[@index=0]")))).Tap(1, 2);


Hi Guys, Did anyone get a solution for datepicker issue?
I am working on mobile web application and not able to select the date from android native calendar.

Thanks in advance.


This is my first reply to someone/something on this forum XP

I will put the code that works for me (in the most simple way in Ruby).

picker = find_element(xpath: "//*[@index='2' and @class='android.widget.NumberPicker']")

The index=2 is for the “year” part of the date (for that reason arg1=“2016”), so you can use index=0 to the day and index=1 do the month part. That works if you have 3 elements with the class android.widget.NumberPicker in the date picker.

I hope it works for you dudes!!

sendKeys() is not working for the date picker. Is there anyone who has found a solution for this?

I resolved this the below way in appium-java client:

Android emulator API level: 28
Android emulator version: 9
Appium java client version: 5.0.4

currentMonthElement is the WebElement that represent the month field in the datepicker. you can use the find by xpath or whichever way you like to find this element. The below code can be reused to enter value for date and year elements. In the place of currentMonthElement variable, please pass the date and year elements.

String monthstr = “Aug”;

//This while loop is required since sometimes the month “Aug” was not successfully entered at the first attempt.

//click on the ok button after setting the date, month and year using the above code.

1 Like

Who uses UiAutomator is best solution. thank you

this is my time picker in that how can i pickup time, anyone can help me

can you send java code. because i am working in java…please