Siep,
Wow! Had to add 'goto validator' to the block but otherwise worked a
treat... Thanks very much! :)
# the Watir gem
require 'rubygems'
# the Watir controller
require 'watir'
# set variables
validator = "http://validator.w3.org/"
urls =[]
urls << "http://www.catnic.com/"
urls << "http://pingmag.jp/2008/01/17/chimpom/"
urls << "http://www.google.com/"
# open the IE browser
ie = Watir::IE.new
puts "Beginning validation"
urls.each do|url|
puts "Checking " + url
ie.goto validator # maybe this should be in the block.
ie.text_field(:id, "uri").set(url)
ie.button(:value, "Check").click
if ie.text.include? "This Page Is Valid"
puts url + " validates!"
else
puts url + " does not validate!" #!! This line needs a 'puts' !!
end
end
ie.close #or something like it
puts "End of validation"
I'm very new to Ruby (programming in general, actually) but I wonder if
there is a way to incorporate this into a webpage? This might not seem
much but is going to make my job as a tester a little easier!
--
Posted via http://www.ruby-forum.com/.