How to handle the Data Picker/Calender Control using WebUI Dev Edition
What should be the Coded Step for accessing the DD/MM/YYYY using Date Picker.
Thanks
17 Answers, 1 is accepted
why do you need to automate this Control with code. Test Studio is designed to keep coding to a minimum. I'm curious as to why you need to use code only. Creating a test with Test Studio's recorder (no coding involved) will save you a lot of time and effort.
Kind regards,
Stoich
the Telerik team

Actually I am creating Testing Framework
I want to do this by Coding only (No Record and PlayBack method).
Like for Caleder Control I want to Do validation for Invalid Date types and only way is to Hanlde through Coded Step
Could you elaborate what is the exact scenario you want to test? If you provide a live url with the page you need to automate and more details about what actions you need to execute or what values need to verify, we will be able to give you more specific directions on how to proceed.
Kind regards,
Pavel
the Telerik team
Register Today!

Hello Pavel
I want to Set the Date (Valid from and Valid To) acording to my requirements for Specific User, also I want Validations like "Start date cannot be after end date"
When I Use Recording method, The Calender Control is Recognized as below:-
// Click 'ContentplaceholderPaymentTermValidityValidFromOpenCalendarDialogButton'
Pages.AUT.FrameApplicationframe.ContentplaceholderPaymentTermValidityValidFromOpenCalendarDialogButton.Click(false);
// Click 'x10Link'
Pages.AUT.FrameApplicationframe.x10Link.Click(false);
// Click 'ContentplaceholderPaymentTermValidityValidToOpenCalendarDialogButton'
Pages.AUT.FrameApplicationframe.ContentplaceholderPaymentTermValidityValidToOpenCalendarDialogButton.Click(false);
// Click 'x27Link'
Pages.AUT.FrameApplicationframe.x27Link.Click(false);
I want to write the Coded Step to Enter Valid from date say ( 10 May 2009) and Valid To date say ( 10 May 2011), These Dates may vary for different User requirements
Also this would help if i want to Modify date only, No need to Record again the Same Case for only Date Changes.
Is the code you provided generated after you have recorded the clicks in test studio? Unfortunately I am still not able to advise you, as I do not have the page you are trying to test and thus I am not aware of the generated html you need to manipulate. Are you testing an instance of RadCalendar/RadDatePicker, or is it some other control?
Regards,
Pavel
the Telerik team
Register Today!

This Code appears after Recording in Test Studio
Here is Code appears in Pages.g file when I add Calender Control Elements (Open Calender Control, Select Date, Select Month, Navigations keys for Changing months) one by one.
here is the File as Attachment <<Pages.g.cs>>
These are not a part of RadCalendar/RadDatePicker, these are part of .net calender control.

if I want to add @Today's date into Valid from field, How do I pick it from Windows Calender control.
I have prepared a simple test which is running against this page. Let me know if that helps.
Kind regards,
Pavel
the Telerik team
Register Today!

Hi
This Solution is for ASP.Net AJAX control, but in my Application Custom Calender Control is Used
If i select the Next Month through Navigation Keys > then it is recognized as:-
public ArtOfTest.WebAii.Controls.HtmlControls.HtmlImage WebResourceAxdDWy5yaGUgbh8XmnKNqiUU0rZpHde9eBAzi9MFUR1hdlcjmiGXcoxBgPS28b0NbGULXc3Lqx867dg5cPLC03LgDGJfl0XQooS8243FN0DXG3s6beaKyeggJL0xlboYEn6GDcXjGE28GiLszSYlxCvRUczcOm6Glj2dWYeVgRmKmcDf0AmpT634406742840000000Image
{
get
{
return Get<ArtOfTest.WebAii.Controls.HtmlControls.HtmlImage>("src=http://Machine5072:81/App/WebResource.axd?d=-wy5yaGUgbh8XmnKNqiUU0rZpHde9eB" +
"Azi9MFUR1hdlcjmiGXcoxBgPS28b0NbGULXc3Lqx867dg5cPLC03Lg-dGJfl0XQooS8243FN0DXG3s6b" +
"eaKyeggJL0xlboYEn6GDc-xjGE28GiLszSYlx-cvRUczcOm6Glj2dWYeVgRmKmcDf0&t=6344067" +
"42840000000", "tagname=img");
}
}
When I select the Date, it is recognized as:-
/// Find logic
/// (Html): [tagname 'Exact' a] AND [TextContent 'Exact' 12]
///
/// </summary>
public ArtOfTest.WebAii.Controls.HtmlControls.HtmlAnchor x12Link
{
get
{
return Get<ArtOfTest.WebAii.Controls.HtmlControls.HtmlAnchor>("TextContent=12", "tagname=a");
}
}
How to Automate this or should I enter date manually in textboxes:(

Hope this Helps.
As explained previously, it is not possible to create a coded test without having the actual html output of the page in question. That is why I sent you a sample against a publicly available page, on which you can comment.
Regards,
Pavel
the Telerik team
Register Today!

Test Studio allows you to highlight any element on a page and add steps against it while in recording mode. Please try to add the necessary steps with the help of the elements menu - possibly you might need to locate the element in the DOM tree and then manually add the steps from step builder in the recording toolbar. Depending on the exact variation of the datepicker, you should be able to directly enter the desired date in the input filed.
In case the above information is insufficient and you need further assistance, please prepare a sample for the datepicker you need to automate along with the scenario to cover and what difficulties you are facing. That way I will be able to provide more exact advice based on the particular case.
Thanks in advance.
Regards,
Elena Tsvetkova
Progress Telerik
Test Studio Trainings

Hi,
How to handle Date picker in telerik test studio with recording mode,i need date 25/02/2018 (MM/DD/YYYY)
I our application using date picker i am picked the date for the particular date from the date picker.
Kindly do the needful.
Hi Shanmugaraju,
The date picker control has its specifics and these need to be taken into account when automating such.
Using the calendar to select the desired date may be applicable in some scenarios if using data driven approach. This is because the displayed month is different depending on the current date.
However, when you need to enter an exact date by each test execution, it will be best to enter this manually as text in the input field of the calendar control.
Please, give this a try and let me know if it works fine for the date picker you are automating. In case you face any troubles, please, let me know if you can share access to the application under test and demonstrate the control, or alternatively, you can prepare a test to show the issue against a demo page using the same control.
Thank you for your cooperation in advance.
Regards,
Elena
Progress Telerik
Test Studio Trainings
