How to work on CUITe_WinDateTimePicker ?

Nov 6, 2015 at 4:03 AM
Hi All,

I am trying to change the date in CUITe_WinDateTimePicker. and following is my code

Object Declaration :
 public CUITe_WinDateTimePicker dtpDate
        {
            get
            {
                return Get<CUITe_WinDateTimePicker>("ControlName=dateTimePicker1");
            }
        }
Accessing object in CodedUITest file
 OR_StudentSubmitFee objOR_StudentSubmitFee = new OR_StudentSubmitFee();
 objOR_StudentSubmitFee.dtpDate.DateTimeAsString = "07-Nov-2015";
When i run the program, its says element not found.

Click here to see the property details

One more question,

I can take any properties displayed in UIMap property windows ? Since i tried multiple properties to identify object like friendlyName but still same error saying that object not found.

Could any one help me on this ?

Note : I am able identify textbox in same window screen.

Thanks
Neeraj
Nov 8, 2015 at 4:13 AM
Hi All,

Any update ?
Coordinator
Nov 8, 2015 at 8:25 AM
Hi.

It seems you are testing a WPF application, and if so, you should be using the CUITe_WpfDateTimePicker class.

Thank you.
Nov 8, 2015 at 9:13 AM
Hi icnocop,

How do i check that i my application is WPF ?, Please correct me if am wrong. I have attached screenshot of properties window of object identification (DatetimePicker) and there classname showing as WindowsForm10.sys...... and control type is datetimepicker.

So, i guess this is winform only. let me know if i am wrong.

Thanks,

Neeraj
Coordinator
Nov 8, 2015 at 9:47 AM
Hi Neeraj,

If you run the Visual Studio Coded UI Test Builder, which control type does it use to identify the DateTimePicker?

Is the class part of the WinControls or WpfControls namespace?

I believe even if your application was built using WinForms, the controls can be tested against using the WpfControls namespace.

The WinControls namespace is for Win32 applications built using C++/MFC for example.

Thank you.
Nov 9, 2015 at 4:11 AM
Hi icnocop,

I am sure that it is winform only bcoz, i am able to identify and perform on textbox and button elements, how facing problem with datetimepicker and dropdown elements.

If you could give example for both then that would be great help.

Thanks
Neeraj
Coordinator
Jan 22, 2016 at 4:16 AM
If you run the Visual Studio Coded UI Test Builder, which control type does it use to identify the DateTimePicker?
Here is an example WinForms test for a DateTimePicker:
https://github.com/icnocop/cuite/blob/7566a1eb1803102c7cc37bec6034e6134be3c369/src/Sut.WinForms.ControlsTest/ControlTests.cs#L53

Here is an example WinForms test for a ComboBox:
https://github.com/icnocop/cuite/blob/7566a1eb1803102c7cc37bec6034e6134be3c369/src/Sut.WinForms.ControlsTest/ControlTests.cs#L46