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:


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

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

Easy, aint it!


No comments:

Post a Comment