cancel
Showing results for 
Search instead for 
Did you mean: 

TestComplete function to capture system clock of computer

SOLVED
Highlighted
Occasional Contributor

TestComplete function to capture system clock of computer

Hello, can someone tell or show me how can I capture the system clock time/date and use it to compare the time/date to an object property checkpoint value , and report the result to a log, pass if it matched.

 

Also if it can check the format if is correct as well but this can be a seperate check.

 

I am using Keyword scripting and if I can add it to a script routine it will be nice.  Thank you !!

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Community Leader

Re: TestComplete function to capture system clock of computer

Hi Ned

 

"capture the system clock time/date"

Use the aqDateTime.Today method to get the current date.

To obtain both the current date and time, use the Now method

To obtain only the current time, use the Time method.

 

Doc link: https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqdatetime/today.html

 

"to compare the time/date to an object"

The aqDateTime.Compare method compares two Date/Time values.

 

"I am using Keyword scripting and if I can add it to a script routine it will be nice."

Check my tutorial on this topic:

https://community.smartbear.com/t5/TestComplete-Functional-Web/Add-a-check-on-the-file-extension-typ...

 

"How to check results"

Use -> aqDateTime.Compare

Result Value

An integer number that indicates the comparison result. The possible values are:

-1 Date1 is earlier than Date2
0 Date1 is equal to Date2
1 Date1 is later than Date2

 

Use these values inside if condition to obtain results.

 

let result = aqDateTime.Compare(Date1, Date2);

if(result === 1) {
  Log.Checkpoint("It's 1!");
}

View solution in original post

Highlighted
Community Leader

Re: TestComplete function to capture system clock of computer

Hi nedbacan,


1) You can try to access this property from the first screenshot using the file object.innerText save it in the variable

2) get the current time using the native TestComplete built in class. You have doc in my first entry

3) parse1 and 2 to the appropriate date format

4) use the native TestComplete solution to compare values.


I hope this will help you!

 

View solution in original post

4 REPLIES 4
Highlighted
Community Leader

Re: TestComplete function to capture system clock of computer

Hi Ned

 

"capture the system clock time/date"

Use the aqDateTime.Today method to get the current date.

To obtain both the current date and time, use the Now method

To obtain only the current time, use the Time method.

 

Doc link: https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqdatetime/today.html

 

"to compare the time/date to an object"

The aqDateTime.Compare method compares two Date/Time values.

 

"I am using Keyword scripting and if I can add it to a script routine it will be nice."

Check my tutorial on this topic:

https://community.smartbear.com/t5/TestComplete-Functional-Web/Add-a-check-on-the-file-extension-typ...

 

"How to check results"

Use -> aqDateTime.Compare

Result Value

An integer number that indicates the comparison result. The possible values are:

-1 Date1 is earlier than Date2
0 Date1 is equal to Date2
1 Date1 is later than Date2

 

Use these values inside if condition to obtain results.

 

let result = aqDateTime.Compare(Date1, Date2);

if(result === 1) {
  Log.Checkpoint("It's 1!");
}

View solution in original post

Highlighted
Occasional Contributor

Re: TestComplete function to capture system clock of computer

Appreciate your help but I am new to scripting. 

 

Please if you can elaborate how will I get the time displayed as a label on the screen (see attachment) and compare it to the system clock using the aqDateTime.Compare method.   I added a screen shot of the object property of the label, which name will work to compare with the system time?

 

I need to add both times as variables? 

 

Anyhow a small demonstration would be great as you did in the tutorial below ..!!  

 

Thank you very very much. 😃

Highlighted
Community Manager

Re: TestComplete function to capture system clock of computer

Thank you for your help Wamboo!

 

Hi @nedbacan, were you able to solve this? Please share what your current situation is. 


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Highlighted
Community Leader

Re: TestComplete function to capture system clock of computer

Hi nedbacan,


1) You can try to access this property from the first screenshot using the file object.innerText save it in the variable

2) get the current time using the native TestComplete built in class. You have doc in my first entry

3) parse1 and 2 to the appropriate date format

4) use the native TestComplete solution to compare values.


I hope this will help you!

 

View solution in original post

New Here?
Join us and watch the welcome video:
Top Kudoed Authors