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.

Can i insert current time and date in a textbox

shobhitshobhit Members
edited November -1 in Sahi - Open Source
I need to insert current date and time , with a string in textbox , so that i can assert according to the timestamp ,, sahi records the typed string , but can we append date time with it

Comments

  • narayannarayan Administrators
    Yeah Shobhit,

    You could do

    var $date = new Date();
    _setValue(_textbox("xx"), "my string " + $date);

    Cheers,
    Narayan
  • var $date = new Date();
    _setValue(_textarea("question"), "mg" + $date);

    I put this string in my script ,but it failed.

    _setValue(_textarea("question"), "mg" + Fri Mar 05 2010 11:17:29 GMT+0530 (IST));
    --Stopped Playback: FAILURE--
  • narayannarayan Administrators
    Use

    var $date = "" + new Date();
    _setValue(_textarea("question"), "mg" + $date);

    First converting $date to a string (by adding "") and then adding to mg.
  • Cool...It worked.... Thanks a ton
Sign In or Register to comment.