Interview Questions

How to have winrunner insert yesterdays date into a field in the application?

Mercury WinRunner FAQ


(Continued from previous question...)

How to have winrunner insert yesterdays date into a field in the application?

1) Use get-time to get the PC system time in seconds since 01/01/1970
2)Subtract 86400 (no seconds in a day) from it
3)Use time_str to convert the result into a date format
4)If format of returned date is not correct use string manipulations to get the format you require
5) Insert the date into your application
Alternatively you could try the following :
1) In an Excel datasheet create a column with an appropriate name, and in the first cell of the column use the excel formula 'today() - 1'
2) Format the cell to give you the required date format
3) Use the ddt- functions to read the date from the excel datasheet
4) insert the reteived date into your application

(Continued on next question...)

Other Interview Questions