How can I get the system clock time in a global variable of when button (object) is clicked?
(1) - I would like to create a test in JavaScript that will capture the system date/time (T1) of when the button was clicked and store that time in a global variable.
Next compare the captured time (T1) to a later time (T2) of another event (button clicked) to get the duration time. The time is not from the AUT, but from MS Windows.
I understand I can use the aqDateTime.Compare(DateTime1, DateTime2) but I guess the question is really on getting the button click time from the system clock.
Can you please provide a complete example?
(2) - Another question regarding time, is it possible to capture the time zone and display it in this format "2022-12-05T15:18:23+02:00" ?
The following code output this format Time: Tue Jan 24 2023 10:20:00 GMT-0500 (Eastern Standard Time) but I need it in this format "2023-24-01T15:18:23+02:00"
function ClickButton() {
var currentTime = new Date().toString();
Log.Message("Time: " + currentTime);
}
The reason for this test, is to verify an audit report, but there can be users in different time zones.
Somethig like this,
Aliases.Fetchbtn.Click(); // Perform click here const t1 = new Date(Date.now()); Log.Message("First button clicked at: " + t1.toUTCString());