This is a migrated thread and some comments may be shown as answers.

Driving RadDatePicker from an automated test

3 Answers 115 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 10 Oct 2011, 09:41 AM
Hello,

I'm trying to write an automated test to drive an ASP.NET web app that includes a RadDatePicker control.  I don't really need to drive the date-selection pop-up - I'd be happy with being able to enter the date into the input field.  However, although I can "type" the text into the input field, it would appear that the date isn't really being set in the control, and nothing is being posted back to the server.

I wondered if there was a "trick" I needed to use (like there is for selection from a combo box for example: http://www.telerik.com/community/forums/aspnet/combobox/select-value-in-telerik-combo-box.aspx)

I'm using WatIn, although I imagine a Selenium user would have the same issue.

Can you help?

Thanks!

John

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 10 Oct 2011, 10:53 AM
Hello John,

You could set the EmptyMessage for showing the custom text also you can set the visibility of the DatePopUpButton.
Here is the sample aspx:
<telerik:RadDatePicker ID="RadDatePicker1" runat="server">
   <DateInput ID="DateInput1" InvalidStyleDuration="100" Skin="Office2007" runat="server" EmptyMessage="Select Date" >
   </DateInput>
   <DatePopupButton Visible="False" />
</telerik:RadDatePicker>

Thanks,
Princy.
0
John
Top achievements
Rank 1
answered on 10 Oct 2011, 12:01 PM
Thanks for your suggestions, Princy.  However, it doesn't really solve my problem.  Perhaps it would help if I re-state the problem.

  • My acceptance test uses the WatIn framework
  • WatIn drives a browser to test a Web App that includes a Telerik RadDatePicker
  • WatIn can find the input date field by its ID:
    Document.TextField(Find.ById("ctl00_MainContent_rdpInceptionDate_dateInput_text"));
  • WatIn can then enter a date in that field:
    field.TypeText("30/10/2011")
  • I can see that when WatIn does this, the expected date does appear to be "typed into" the browser, and the calendar control pops up below the input field.
  • WatIn then clicks my Submit button for me
  • The date is NOT posted to the server as part of the form, although other fields that WatIn has typed in for me are.

From this I have inferred that when a real user drives the RadDatePicker control, perhaps some clever JavaScript stuff is happening.

How do I get the clever stuff to happen? :-)
0
David
Top achievements
Rank 1
answered on 29 Oct 2013, 09:30 PM
Hi,

Try the following attributes which could work:
<telerik:RadDatePicker .... DateInput-Enabled="true" EnableTyping="true" ... >

Cheers
Tags
Calendar
Asked by
John
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
John
Top achievements
Rank 1
David
Top achievements
Rank 1
Share this question
or