How to send year, month and day to Android date picker

Hi, has anybody figured out an easy way to send a year, month and day to the following Android date picker please?

image

Thanks

Matt

You need to tap on year first, select it, then tap on the arrows of the month until you have the desired month and then pick a day, tap ok to close the overlay.
Please double check the xpath and id declaration I was in a hurry here and might missed something, but you get the logic.

public void selectDate() {
		driver.findelementByID(android:id/date_picker_header_year).click();
//here you may need to scroll a bit after the desired year
	        driver.finelementByXpath(android.view.View[@text = '1990']");
		driver.findelementByID(android:id/next).click();
		driver.findelementByXpath(android.view.View[@text = '9']");
                driver.findelementByXpath(android.widget.Button[@text = 'OK']");
	}
1 Like

Thanks Zuzeac. I’ll see if I can get it to work.