2

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?

1 Answers1

3

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.

Community
  • 1
  • 1
Justin Ko
  • 46,526
  • 5
  • 91
  • 101
  • I think that's the correct answer. Thanks! Even though I would really like to know the reason behind. – AllanNirvana Apr 20 '12 at 04:53
  • And just registered so I can't give you an up. Sorry about that. – AllanNirvana Apr 20 '12 at 04:54
  • HTTPWatch supports both IE and Firefox. The syntax is basically saying for my HTTPWatch object, use the IE methods to attach to a certain browser. This is opposed to someone who wants a Firefox browser. This might be a help [overview of working with HTTPWatch](http://apihelp.httpwatch.com/#Ruby%20-%20Overview.html). – Justin Ko Apr 20 '12 at 11:56