IT's a LOT easier than that ...
 
just add
 
class Watir::IE
  def contains_html( input )
    html.scan( input ) != []
  end
end
 
after you do your require... now it *does* have a contains_html function.
 
assert $ie.contains_html "blah"
or
assert $ie.contains_html /blah/
 
hope that helps.
 
j.

 
On 10/26/05, Sy Ali <[EMAIL PROTECTED]> wrote:
Ok, interpreting Pierre's example, I can come up with the code below.
However, this always fails.  I assume I'm doing something somewhat
wrong here, but I don't quite understand what.


#---------- BEGIN

require 'Watir' # the watir controller
include Watir

# Search for text in the HTML of a page
def search_html(string)
       puts "   searching the source for " + string
       begin
               assert_match(string,$ie.html())
               puts "   ok -- found " + string
       rescue => e
               puts ">>>FAIL -- could not find " + string
       end
end

$ie = Watir::IE.start("http://example.com")

search_html(".")

# ------------ END

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



--
"http://ruby-lang.org -- do you ruby?"

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

Reply via email to