Accessing DatePicker from a code step

4 posts, 0 answers
  1. Ahmed
    Ahmed avatar
    1 posts
    Member since:
    May 2016

    Posted 26 May Link to this post

    Hi

    I am struggling to access Kendo Date Picker from a code step in Test Studio.

    KendoCalendar calendar = ActiveBrowser.Find.ById<KendoCalendar>("expiryDate");

    I want to set the date from the code step ( I am iterating over a predefined expiry values) 

    but I always get NULL and nothing is returned.. any idea why ? Test Studio version 2016 (downloaded it last week)

     

    My jsp has the following:

    ...

    ..
        <input type="text" id="expiryDate"     style="width:180px;"
            serializedDate="${message.getExpiryDate().getTime()}"  
            name="expiryDate"   
            required 
            data-expiryDateInPast-msg="<s:message code='admin.managemessage.validation.expiryDate.inpast'/>"
                   validationMessage="<s:message code='admin.managemessage.validation.expiryDate.empty'/>" 
            />

    ...

    ...

    $("#expiryDate").kendoDatePicker({
                                      
            }).on('keydown',function(evt){
                   if(evt.keyCode == 9) {
                        return true;
                   }
                   return false;
            }).on("paste",function(e) {
                  e.preventDefault();
            });

    ...

    ...

  2. Boyan Boev
    Admin
    Boyan Boev avatar
    1045 posts

    Posted 31 May Link to this post

    Hello Ahmed,

    KendoCalendar is implemented as a simple input so the easiest way how to set the date is to click on that input and simply type the date.

    Please find attached a sample project against our demo site.

    Let me know if that helps.

    Regards,
    Boyan Boev
    Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  3. Ahmed
    Ahmed avatar
    1 posts
    Member since:
    May 2016

    Posted 31 May in reply to Boyan Boev Link to this post

    Thanks Boyan ..

    I missed to mention that the typing into the input for the datepicker is already disabled (to force the user to follow some rules on date selection). any input typing is just ignoring . In Sillinum I used to do the following:

    1.((JavascriptExecutor)driver).executeScript('$("#expiryDate").data("kendoDatePicker").value(addDays(new Date(),30))');

    I tried to do somthing similar in Test Studio using  Actions.InvokeScript:

     

    1.Actions.InvokeScript('$("#expiryDate").data("kendoDatePicker").value(addDays(new Date(),30))')

    but it failed with null error

  4. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 03 Jun Link to this post

    Hello Ahmed,

    Let me interject into this as Boyan is out of the office.

    The second line of code provided is not a correct syntax at all.

    In order to assist any further we will need you to provide us with access to the application and your test.

    Regards,
    Ivaylo
    Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
Back to Top