There are two problems ... #1 you can't use the assert functions unless you are building a TestCase object...

#2 you don't need the search_html function.
 
just
 
require 'watir'
include Watir
 
class Watir::IE
  def contains_html( input )
    html.scan( input ) != []
  end
end
 
$ie = IE.new
$ie.goto http://example.com
$ie.contains_html( "." )
 
should return a true or false. so you could do
 
if $ie.contains_html "."
  puts "Has html"
else
  puts "Doesn't have html"
end
 
... that's all there is to it... My code was meant as an alternative ...
 
but any function that people send to you that contains assert won't work without additional libraries being required.
 
Let me know if my example doesn't work for you.
 
j.

 
On 10/26/05, Sy Ali <[EMAIL PROTECTED]> wrote:
Jeff, does that mean that I do this? :

require 'Watir' # the watir controller
include Watir

class Watir::IE
def search_html( input )
   html.scan( input ) != []
end
end
def search_html(string)
       puts "   searching the source for " + string
       begin
               assert_match($ie.contains_html,string)
               puts "   ok -- found " + string
       rescue => e
               puts ">>>FAIL -- could not find " + string
       end
end

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


Because this also fails..

_______________________________________________
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