Script Error

Script Error

Title: Internet Explorer

Text:

Problems with this Web page might prevent it from being displayed properly
or functioning properly. In the future, you can display this message by
double-clicking the warning icon displayed in the status bar.
Always display this message when a page contains errors.

Buttons: OK, Show Details

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Oct 05, 2010

    Sith Nip says:

    I used the information from this page: http://exploretesting.blogspot.com/2008/...

    I used the information from this page:

    http://exploretesting.blogspot.com/2008/09/reporting-ie-js-error-messages-in-watir.html

    here's my version for IE8:

    def error_msg_detect(browser)
        autoit=WIN32OLE.new("AutoItX3.Control")  #use this instead of watir.autoit
        # Error detector, runs in seperate thread
         return error_detector = Thread.new do
           # Loop for Ever!
           loop do
              if autoit.WinExists("Windows Internet Explorer")  #added this condition to close the script error popup.
                autoit.WinClose("Windows Internet Explorer")
              end
             browser_status_text = autoit.statusbargettext(browser.title)
             puts "Status bar: #

    Unknown macro: {browser_status_text}

    "        

         # Detected an error mesage in the Status Bar

             if browser_status_text.downcase.scan(/error/).length > 0
               puts "Error detected!"
               # Run the block of code passed into the method, usually for screen shots or logging etc
               yield
               # Close the popup msg window, its the one with the title...
               autoit.WinClose("Internet Explorer")
               # Stop looking for error msgs...
               break
             end # end if
             # Wait a bit then try again
             sleep 0.5
           end # loop
         end # end thread
      end # end error msg detect method