Bret Pettichord wrote:
>I am thinking of adding a Map class to Watir. Here's how it would work...
I found this an interesting problem, and as it applied to something I was
doing at work, I wanted to give it a stab. Below is my "hack" at a Map
class. It only works in Watir 1.5. So, how many rules did I break? ;)
# Watir 1.5 ONLY!!!
require 'watir'
module Watir
class Map
def initialize(ie)
@ie = ie
Watir::Container.instance_methods.each do |method|
Map.class_eval("def #{method}(k,v); @ie.#{method}(k,v); end") if
method !~/=/
end
end
end
end
ie = Watir::IE.start('http://google.com')
map = Watir::Map.new(ie)
SearchField = map.text_field(:name, 'q')
SearchButton = map.button(:name, 'btnG')
SearchField.set('PickAxe')
SearchButton.click()
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general