Possible issue with Watir method "check_for_http_error" and IE8
---------------------------------------------------------------

                 Key: WTR-434
                 URL: http://jira.openqa.org/browse/WTR-434
             Project: Watir
          Issue Type: Bug
          Components: Other
    Affects Versions: 1.6.5
         Environment: IE 8
            Reporter: Joe DiMauro


In Watir 1.6.5 it appears that the method check_for_http_error does
NOT support IE8, as there is NO check for "8.0", only for "7.0", or a
default to IE6. I noticed this because some pages I've hit in my tests
run in IE8 are NOT raising NavigationException's even when one has
occurred.

Here's the current method:

# File lib/watir/page-container.rb, line 10

   def check_for_http_error
     # check for IE7
     n = self.document.invoke('parentWindow').navigator.appVersion
     m=/MSIE\s(.*?);/.match( n )
     if m and m[1] =='7.0'
       if m = /HTTP (\d\d\d.*)/.match( self.title )
         raise NavigationException, m[1]
       end
     else
       # assume its IE6
       url = self.document.location.href
       if /shdoclc.dll/.match(url)
         m = /id=IEText.*?>(.*?)</i.match(self.html)
         raise NavigationException, m[1] if m
       end
     end

I'd recommend swapping the condition and make IE7 and later the default, and 
IE6 the exception. This presumes that future versions of IE will behave like 
IE7/IE8, and not like IE6. Thus the new code would be:

def check_for_http_error
  # Determine the IE Version
  n = self.document.invoke('parentWindow').navigator.appVersion
  m=/MSIE\s(.*?);/.match( n )  
  if m and m[1] =='6.0' # Deal with IE6
    url = self.document.location.href
    if /shdoclc.dll/.match(url)
      m = /id=IEText.*?(.*?)</i.match(self.html)
      raise NavigationException, m[1] if m
    end
    
  else # Presume its IE7 or later
    if m = /HTTP (\d\d\d.*)/.match( self.title )
      raise NavigationException, m[1]
    end
    
  end
  
  false
end
      false
    end 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.openqa.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
Wtr-development mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-development

Reply via email to