You can capture the error in begin rescue loop so no need to worry whether its get populated or not You can do like this below begin
rescue =>e @msg=ErrorMessage(e) end for writing to a file f = File.new(c:\log.txt,"w") @msg.each do |content| f.write(content) end f.close() I think this will solve the problem Thanks, Chethan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Watir General" group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~----------~----~----~----~------~----~------~--~---