18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

Capturing the date and timestamp

garimagarima Members
edited November -1 in Sahi - Open Source
In my application which is developed on GWT there is this date field which automatically populates today's date.
So as soon as you reach this page other fileds will be emplty but date field will already have a value.So while recording I entered the data in other fields and kept the date field data same (ie.current date).
So while playing back the script fails at the date field coz the time stamp or the time it was recorded was different and sahi is unable to find the captured date at the same timestamp.
Kindly suggest ways to handle this situation.

Comments

  • Hi Garima,

    You could use the Date object in javascript to fetch the current date and then check with the date populated in the date field (in the application).

    For example,
    //Assume _textbox("dateField") has 25/11/2011
    var $date = new Date();
    var $parsedDate = $date.getDate() + "/" + ($date.getMonth()+1) + "/" + $date.getFullYear();
    _assertEqual($parsedDate, _getValue(_textbox("dateField")));
    

    Check if this works?

    regards,
    Sumitra
Sign In or Register to comment.