var list1 = appMainWindow.GetMultiple(SearchCriteria.ByAutomationId("List1"))[0]; var child1 = ((UIItemContainer)list1).Get<Panel>(SearchCriteria.ByAutomationId("monthCalendar"));
Currently it supports only Date and not the time. Since there is no native support for DateTimePicker in UIAutomation for setting the value, White uses keyboard to set the value. When the value is set it enters the value, without opening the calendar. Hence it is important for it to know the DateFormat. There are two ways to set the date.
DateTimePicker dateTimePicker = window.Get<DateTimePicker>("dob");
dateTimePicker.Date = DateTime.Now.AddMonth(1);
In this case DateTimePicker would use the configured DateFormat (in case no explicit configuration it uses default format based on the current culture).
DateTimePicker dateTimePicker = window.Get<DateTimePicker>("dob");
dateTimePicker.SetDate(DateTime.Now.AddMonth(1), DateFormat.YearDayMonth);
These are possible DateFormats: DayMonthYear, DayYearMonth, MonthDayYear, MonthYearDay, YearMonthDay and YearDayMonth
You need to set the DefaultDateFormat property in the configuration file under section Core. The possible values are: "DayMonthYear", "DayYearMonth", "MonthDayYear", "MonthYearDay", "YearMonthDay" and "YearDayMonth"
From TS:White github page.
But this is assuming you have a DateTimePicket UIitem - if this isn't exposed in the inspect tool - i'd say you have a problem then.
DateTimePicker dateTimePicker = appMainWindow.Get<DateTimePicker>(SearchCriteria.ByAutomationId("monthCalendar"));
As a workaround I had to request our Dev team to make the date field editable in "Automation Mode", so I could insert desirable dates straight into field bypassing DatePicker.
Thanks,
Alex