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

Accessing DatePicker from a code step

3 Answers 185 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ahmed
Top achievements
Rank 1
Ahmed asked on 26 May 2016, 06:44 PM

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();
        });

...

...

3 Answers, 1 is accepted

Sort by
0
Boyan Boev
Telerik team
answered on 31 May 2016, 12:00 PM
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!
0
Ahmed
Top achievements
Rank 1
answered on 31 May 2016, 03:03 PM

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

0
Ivaylo
Telerik team
answered on 03 Jun 2016, 12:58 PM
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!
Tags
General Discussions
Asked by
Ahmed
Top achievements
Rank 1
Answers by
Boyan Boev
Telerik team
Ahmed
Top achievements
Rank 1
Ivaylo
Telerik team
Share this question
or