Forum Discussion

sathish_subrama's avatar
sathish_subrama
Occasional Contributor
11 years ago

Calender control need to automate.


Need to automate the calendar control. Try to select the date in the grid.


Issues:


Entire page is highlight as the grid. Calender was developed at the side of the page.


.Click(x,y) is not reliable, because each month starts with different day.


Week’s first day starts with Sunday, ends with Saturday.So unable to use X,Y axis.


Kindly provide how to automate the calendar controls.

6 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Ravik,



    Ajax is a technology targeted to make it possible to perform a partial web page update without the necessity to reload the whole page and thus it does not define the used control.



    Regardless of the technology used by the given (calendar) control, I know only two possible options to set its value:

    1) Investigate the control in the Object Browser and find a property or method (ther may be more than one such property/method available, for example text and value properties) that can be used to assign a value to the control. After you assigned the value to the control check if the assigned value can be correctly accessed by the tested web application;

    2) If you cannot locate the property/method mentioned in the paragraph 1) or if the tested application behaves incorrectly after the value is assigned to the control from the test code, you will need to open the calendar drop-down and select/confirm the value from there. If you are lucky, then the calendar drop-down will have the entered date highlighted when opened so you will have just to confirm it. It the tested control is implemented in a way that it does not highlight the date according to the entered value, then you will have to create a test code to deal with the drop-down control;

    3) One more possible approach is to use TestComplete's functionality to call JavaScript functions from web page. So, if the tested web page provides a JavaScript function that sets the value of the calendar control you may call it from your test code. See http://support.smartbear.com/viewarticle/55290/ for more details. To use this approach you may need to consult with your web developers.
  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Guys,



    First of all, it would really help if you let us know at least what type of application you are automating: desktop, web, flash, silverlight, etc. I am not even wondering about the class name of the calendar control...

    Another question: do you need to test the calendar control itself or just be able to get/set its value?

    In the latter case, the following approach worked quite often for me:

    -- Find a property that either corresponds to what you see on the screen (e.g. 02/05/14) or contains date value in the numeric form (e.g. 10215 which can be obtained by the call, for example, to aqConvert.StrToDate()), try to assign a value to this property and than check if the tested application obtains correct expected value (e.g. that expected date is used in the subsequent calculations);

    -- If it looks like that after the above step the tested application obtains incorrect date, then, probably, some internal control's fields were not updated. In this case, after the date value was assigned to the property, you may try to open the drop-down calendar using whatever method is supported by the control (e.g. click button with the triangle, press down arrow key, etc.). The chances are high that after the calendar drop-down will be opened, the correct date will be highlighted. In this case just confirm the selection (e.g. click OK, press Enter, etc.) and with high probability all internal control's fields will be updated correctly;

    -- The last chance is to look for the exposed method (on the Methods page of the Object Browser) that can be used to set the required date value to the control.



    Hope that the above will help.
  • vajindarladdad's avatar
    vajindarladdad
    Frequent Contributor
    Hi,

    Use can use the following functions to set the date.



    set_DateTime(strDateInformation)

    set_text(strDateInformation)



    I hope this has been of some help.

  • Ravik's avatar
    Ravik
    Super Contributor
    Alexei Karas



    1- In Our application, we are using Ajax DateControl.



    2- While I am trying to enter date using SetText(aqConvert.DateTimeToFormatStr(Date(),format string)

    It's giving error "Unable to Enter Data because text in ReadOnly"



    3- While I am select date on click of calendar it's work fine in same month but when month is change it's again through errors





    Please Suggest suitable way to handle ajax Date control.



    Thanks

    Ravik  
  • Ravik's avatar
    Ravik
    Super Contributor
    Alexei Karas



    1- In Our application, we are using Ajax DateControl.



    2- While I am trying to enter date using SetText(aqConvert.DateTimeToFormatStr(Date(),format string)

    It's giving error "Unable to Enter Data because text in ReadOnly"



    3- While I am select date on click of calendar it's work fine in same month but when month is change it's again through errors





    Please Suggest suitable way to handle ajax Date control.



    Thanks

    Ravik