Ruby: Watir HRESULT error code 0x80020006

Hi,

I'm having some problems with a Ruby script that I've adapted to use
HTTPWatch. The program uses Watir, and goes through a site and checks
all the links.

However when the link checker reaches a page that is a redirect then the
following error occurs:

c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1230/./watir.rb:4188:in
`method_missing': unknown property or method `getElem
entsByTagName' (WIN32OLERuntimeError)
    HRESULT error code:0x80020006
      Unknown name. from
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1230/./watir.rb:4188:in
`length'
        from
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1230/./watir.rb:2817:in
`initialize'
        from
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1230/./watir.rb:613:in `new'
        from
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1230/./watir.rb:613:in
`links'
        from
H:/Test_scripts/Watir_scripts/test_scripts/Http_Watch/httpwatch.rb:94

The code snippet in question is this section, with the error occurring
on the line 'e.links().each do |link|':

ie.goto(nextUrl) # get WATIR to load URL
    @PageCounter += 1
        urlsVisited.push( nextUrl) # store this URL in the list that
has been visited
     # Look at each link on the page and decide if it needs to be
visited

    ie.links().each do |link|
      linkUrl = link.href.CanonicalUrl
      if @response.code == '301'||@response.code ==
'302'||@response.code == '303'||@response.code == '304'||@response.code
== '305'||@response.code == '306'||@response.code == '307'
        puts @response.code
        next
      end
      # if the url has already been accessed or if it is a download or
if it from a different domain
      # linkUrl.Path.include?( ".pdf" )
      if !url.IsSubDomain( linkUrl.HostName ) ||
linkUrl.Path.include?(".zip") || linkUrl.Path.include?( ".png" ) ||
         urlsToVisit.find{ |aUrl| aUrl == linkUrl} != nil ||
urlsVisited.find{ |aUrl| aUrl == linkUrl} != nil
        # Don't add this URL to the list
         next
      end
      # Add this URL to the list
      urlsToVisit.push(linkUrl)
    end

Any ideas on this?

Andrew

···

--
Posted via http://www.ruby-forum.com/.