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.

I want to pass one date which is a previous date from the displayed date.

gyanadeepgyanadeep Members
edited May 2013 in Sahi - Open Source
Here it goes-

In one page I have one created date in DDMMYYYY format-
And I want to pass one date in another field which is previous date from this created date.

I can pick this created date from getText method but don't how I will send a past date .

Regards,
Gyanadeep

Answers

  • gaveyomgaveyom Members
    Hi,

    try the following code with minor changes
    
    var d = new Date();
    d.setDate(d.getDate() - 1);
    
    
  • Hi Gaveyom,

    Thanks for your information. But my issue is little bid different from above.

    I am extracting one date from HTML web page like this -

    var $c= _getText(_div("orderDetailItemText[13]"));

    this is returning me a date with format DD/MM/YYYY HH:MM

    And i want to pass one date which is previous date from this extracted date with format DD/MM/YYYY

    So what will be the script ?
  • Hi gyanadeep,

    i think, you will need to take a substring of value DD, minus it by 1 if its not 01.
    if day is 01, you will need minus month and set day according to month.
Sign In or Register to comment.