DatePicker

Thread is closed for posting
4 posts, 1 answers
  1. Jakub Wilk
    Jakub Wilk avatar
    27 posts
    Member since:
    Nov 2003

    Posted 12 Oct 2009 Link to this post

    Hi,
    I have on page RadDatePicker

    <tel:RadDatePicker ID="dpStartDate" runat="server" DateInput-ID="diStartDate">  
    <Calendar ID="c1" runat="server" FocusedDate="2006-10-30" />                      
    <DateInput CatalogIconImageUrl="" Description="" DisplayPromptChar="_" PromptChar=" " 
    Title="" TitleIconImageUrl="" TitleUrl=""  />                      
    </tel:RadDatePicker> 

    I'm trying to set a date in this RadDatePickter using WebAii Free testing framework.
    When I get an instance of this picker there is no method or property to set a date. All of the are only "get" properties.
    How I can achieve this functionality?
    Seba

  2. Answer
    Pavel
    Admin
    Pavel avatar
    902 posts
    Member since:
    Jan 2013

    Posted 13 Oct 2009 Link to this post

    Hello Seba,

    You can access the DateInput part of the picker and type the value in it or simply set the date via the InputValue property. Here is a code snippet for illustration:

    RadDateInput input = Find.ById<RadDateInput>("dpStartDate_dateInput_wrapper");
    //input.InputValue = DateTime.Today.AddDays(3).ToShortDateString();
     
    input.TypeText(DateTime.Today.AddDays(3).ToShortDateString());


    Kind regards,
    Pavel
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.


  3. Test Automation Webinar
  4. Jakub Wilk
    Jakub Wilk avatar
    27 posts
    Member since:
    Nov 2003

    Posted 13 Oct 2009 Link to this post

    Thanks!

    Its working

  5. Pavel
    Admin
    Pavel avatar
    902 posts
    Member since:
    Jan 2013

    Posted 16 Oct 2009 Link to this post

    Hello Seba,

    Just a quick note on an improvement we've made and which will be available in the 2.0 version of the Testing Framework. We have added a property which exposes the DateInput part of the Picker's wrapper. Here is a sample test:

    [TestMethod]
    public void SetDate()
    {
        Manager.LaunchNewBrowser();
     
        RadDatePicker picker = Find.ById<RadDatePicker>("RadDatePicker1_wrapper");
        ((RadDateInput)picker.DateInput).InputValue = DateTime.Today.AddDays(3).ToShortDateString();
        Assert.AreEqual(DateTime.Today.AddDays(3), picker.SelectedDate);
    }


    Regards,
    Pavel
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

Back to Top