Search code examples
rubyinternet-explorer-9watirhttpwatch

WIN32OLE.attach is an undefined method when trying to attach HTTPWatch with Watir to work in IE9


I've been trying to get HTTPWatch work with Watir automation in IE9.

I searched these sites which provide the code:

Link1

So I basically copied their piece and wrote this piece of code just to test the attach method:

**require 'rubygems'
require 'win32ole'
require 'watir'
ct = WIN32OLE.new('HttpWatch.Controller')
ie = Watir::IE.new
httpw = ct.Attach(ie.ie)**

and I got the following error: NoMethodError: undefined method `attach' for WIN32OLE:Class

My Ruby is 1.8.7, Watir is 2.0.1, HTTPWatch is 8.1, IE 9. I have to use those versions as defined by the team.

I've been searching on google for hours, I found that attach is not a listed method in WIN32OLE here: http://ruby-doc.org/stdlib-1.8.7/

So I wonder how would I be able to use HTTPWatch to record time spent by Watir automation in IE9?


Solution

  • I think you want:

    httpw = ct.IE.Attach(ie.ie)
    

    Note: This is based on what I saw in another question regarding getting HTTPWatch with Watir-Webdriver (instead of original Watir). I do not have HTTPWatch, so I have not tested it.