This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.
1 / 4
Feb 2019

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

  • created

    Feb '19
  • last reply

    Feb '19
  • 3

    replies

  • 415

    views

  • 3

    users

  • 1

    link

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']");
	}