Xamarin.forms: How to interact DatePicker,Time picker and Number picker dialog through automation id support ?

Created on 6 Sep 2019  路  1Comment  路  Source: xamarin/Xamarin.Forms

Description

Our requirement is how to interact the DatePicker , TimePicker and NumberPicker dialog elements through automation id . We have tried in iOS platform the elements has been tapped in automation but in Android it does not work properly.

Steps to Reproduce

  1. Run the sample in Android platform
  2. Try to select the Date in DatePicker and Time in TimePicker and Picker items through Automation.
  3. The element do not selected .

Expected Behavior

The Framework DatePicker, TimePicker and Picker dialog items should be selected while run the automation . It is working fine in IOS platform.

Actual Behavior

The Framework DatePicker, TimePicker and Picker dialog items not selected through automation on android platform.

Basic Information

  • Xamarin.Forms Version used: 3.0.0.482510

  • Platform Target Frameworks:

    • Android: 8.0
  • Android Support Library Version: 27.0.2

Screenshots

DatePicker:
We have tried to select the Date in DatePicker through Automation.
Screen Shot 2019-09-06 at 5 19 48 PM

Time Picker:
Screen Shot 2019-09-06 at 5 21 23 PM

Picker:
Screen Shot 2019-09-06 at 5 22 31 PM

It doesn't work on Android platform , but in iOS works fine.

Reproduction Link

DateTimePickerAutomationId.zip

uitest Android unverified bug

Most helpful comment

For Android, you'll have to invoke the updateDate method on the datePicker. Something like this:

var dateTime = new DateTime(1999, 1, 3);
app.WaitForElement(x => x.Class("DatePicker"));
app.Query(x => x.Class("DatePicker").Invoke("updateDate", dateTime.Year, dateTime.Month, dateTime.Day));

For more info, take a look at this article from @jfversluis : https://blog.verslu.is/xamarin/uitest/pick-date-time-xamarin-uitest/

>All comments

For Android, you'll have to invoke the updateDate method on the datePicker. Something like this:

var dateTime = new DateTime(1999, 1, 3);
app.WaitForElement(x => x.Class("DatePicker"));
app.Query(x => x.Class("DatePicker").Invoke("updateDate", dateTime.Year, dateTime.Month, dateTime.Day));

For more info, take a look at this article from @jfversluis : https://blog.verslu.is/xamarin/uitest/pick-date-time-xamarin-uitest/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

allessandrosj picture allessandrosj  路  61Comments

JasonLooney picture JasonLooney  路  55Comments

mfeingol picture mfeingol  路  58Comments

hartez picture hartez  路  178Comments

hartez picture hartez  路  55Comments