Forum Discussion

Raviavi's avatar
Raviavi
Occasional Contributor
3 years ago

Test Complete is reading the Date wrongly is there any solution for this?

Hi I have date and time control with shown in image attached

When I did spying the control, the date formats are seen as 12:34 ,21/08/04 as shown in attached image

 

But when i use that control property in script to read that control, the date format is automatically changing to,21/08/04, 12:34 

 

Is there any way to use the same date time as is read during the spy in the script alos, i.e without getting it to re format what is being read from the control by test complete

7 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    I cannot see the image for some reason, but these are two options that I can think of:

    a) Examine the control using Object Spy (check if you are using Extended, but not Basic mode) and find a property that holds properly formatted control's value; (this is the preferred option)

    b) If the control allows selection and copying its value, then you may consider a code like this (sample untested pseudo-code):

    obj.Click(); // click control to focus it

    obj.Keys('^A'); // Ctrl-A to select the whole field

    obj.Keys('^C'); // Ctrl-C to copy control's value to the clipboard

    var strValue = Sys.Clipboard; // store value from clipboard into variable

    if (strValue == ... ) // proceed with verification as required

     

    • Raviavi's avatar
      Raviavi
      Occasional Contributor

      Hi,

       

      Its a read only control and i cannot do these ["Keys"] operations on the control

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi,

         

        I still cannot see the images after site update (sonya_m  - FYI).

        Can you confirm that you are using Object Spy / Object Browser in Extended mode and there is no property that contains properly formatted control's value?

        Any chance to talk to developers and ask them how control's value is formatted before been rendered and whether they have some piece of advice on how you can get formatted value?

         

        P.S.

        read only control

        'Read-only' not always means 'non-selectable' but as you've checked it, it is a pity that .Keys() does not work in your case.