Page 1 of 1

DateTimePicker

Posted: Tue Dec 15, 2009 11:58 pm
by makodela
Hi
i have DateTimePicker control in my application
i need to automate the click and selecting date
i have used the option to set the value but i need to see the flow of click and selecting the date ....
how can i do it as click action is not recognized as button click as in other dropdowns
with spy i am seeing very few properties
any helpis appreciated

Re: DateTimePicker

Posted: Wed Dec 16, 2009 11:47 am
by Support Team
If I understand you right you have already noticed that the drop down button is not recognized as a separate button and when you use the spy to track the datetimepicker it selects the list.

The list is a child of the Datetime as you’ll see in the spy. The element you what is the Datetime and not the list. If you are using a repository you can just drag it from spy into the Repository. You will need to convert the Ranorex.Datetime instance to a Ranorex.Control and call the SetPropertyValue Method. The property name that you want to set is ‘Value’.
Here are some links that should help.

http://www.ranorex.com/support/user-gui ... apter.html (the section on Multiple Adapters for one GUI element)

http://www.ranorex.com/Documentation/Ranorex-2.0/
http://www.ranorex.com/Documentation/Ra ... yValue.htm


if you really need to perform the clicks then you will need to use the imaging capabilities of the recorder. You can find a Screencast at this link that shows how to use imaging capabilities http://www.ranorex.com/support/screencasts.html.

I also recommend that you watch the ones on the RanorexPath as well.

Regards,
Ron
Support Team

Re: DateTimePicker

Posted: Wed Nov 02, 2011 8:00 pm
by jtruppia
Thanks, saved my day!

Here is my code, maybe someone will find it useful

Code: Select all

 Ranorex.DateTime dateTimePicker = ranorexRepo.DateChooser.DateTimePicker;
 var control = new Ranorex.Control(dateTimePicker);
 control.SetPropertyValue("Value",System.DateTime.Parse(time).ToShortTimeString());

Re: DateTimePicker

Posted: Mon Mar 26, 2012 4:42 pm
by omayer
I need some tutorial on this line please

var control = new Ranorex.Control(dateTimePicker);

Re: DateTimePicker

Posted: Tue Mar 27, 2012 12:54 pm
by Support Team
Hi,

as described in following chapter of our user guide, this line of code converts the DateTime adapter into a Control adapter:
Ranorex UI Adapter

The Control adapter (which is available for .NET WinForms applications) allows to access more properties than the DateTime adapter.

Regards,
Tobias
Ranorex Support Team