Showing posts with label time difference watir. Show all posts
Showing posts with label time difference watir. Show all posts

Tuesday, October 19, 2010

How to print time stamp in Watir and calculate time difference

So you want to print the time at which a particular event occurred in your script to the output console/file. Here is how you can do it:

puts "Cannot publish occurred at Time Stamp: #{Time.now}"

To find the time difference in Watir all you have to do is define a variable to read the current time:

timeStart=Time.now

And then print out the difference after storing it in another variable

elapsed= Time.now - timeStart
puts "Elapsed[#{elapsed}]"

Easy, aint it!

~joviano_dias@hotmail.com