lib/watirspec/html_formatter.rb in watirspec-0.1.6 vs lib/watirspec/html_formatter.rb in watirspec-0.1.7

- old
+ new

@@ -83,17 +83,22 @@ file_name end def save_javascript_error # :nodoc: file_name = nil - if @browser.is_a?(Watir::IE) && @browser.status =~ /Error on page/ - autoit = Watir::autoit - autoit.AutoItSetOption("MouseCoordMode", 0) - autoit.ControlClick("[TITLE:#{@browser.title}]", "", "[CLASS:msctls_statusbar32]", "left", 2) - popup_title = "[REGEXPTITLE:^(Windows )?Internet Explorer$]" - autoit.WinWait(popup_title, "", 10) - file_name = save_screenshot("JS_Error", autoit.WinGetHandle(popup_title).hex) - autoit.WinClose(popup_title) + begin + if @browser.is_a?(Watir::IE) && @browser.status =~ /Error on page/ + autoit = Watir::autoit + autoit.AutoItSetOption("MouseCoordMode", 0) + autoit.ControlClick("[TITLE:#{@browser.title}]", "", "[CLASS:msctls_statusbar32]", "left", 2) + popup_title = "[REGEXPTITLE:^(Windows )?Internet Explorer$]" + autoit.WinWait(popup_title, "", 10) + file_name = save_screenshot("JS_Error", autoit.WinGetHandle(popup_title).hex) + autoit.WinClose(popup_title) + end + rescue => e + $stderr.puts "saving of javascript error failed: #{e.message}" + $stderr.puts e.backtrace end file_name end # Generates unique file name and path for each example. \ No newline at end of file