From: "lrlebron@..." Date: 2008-01-24T03:19:59+09:00 Subject: Re: using ruby to validate web pages On Jan 18, 8:54 am, Kate Bond wrote: > Hi, just wondering if anybody can tell me what's wrong with this code: > > # the Watir gem > require 'rubygems' > > # the Watir controller > require 'watir' > > # set variables > validator = "http://validator.w3.org/" > url1 = "http://www.google.com" > url2 = "http://pingmag.jp/2008/01/17/chimpom/" > url3 = "http://www.google.com/" > > # open the IE browser > ie = Watir::IE.new > > puts "Beginning validation" > > ie.goto validator > > ie.text_field(:id, "uri").set(url1) > > puts "Checking URL #1....." > > ie.button(:value, "Check").click > > if ie.text.include? "This Page Is Valid" > puts "URL#1 validates!" > else > "URL#1 does not validate!" > > end > > ie.goto validator > > ie.text_field(:id, "uri").set(url2) > > puts "Checking URL #2....." > > ie.button(:value, "Check").click > > if ie.text.include? "This Page Is Valid" > puts "URL#2 validates!" > else > "URL #2 does not validate!" > > end > > ie.goto validator > > ie.text_field(:id, "uri").set(url3) > > puts "Checking URL #3....." > > ie.button(:value, "Check").click > > if ie.text.include? "This Page Is Valid" > puts "URL#3 validates!" > else > "URL #3 does not validate!" > > end > > puts "End of validation" > > I get results for URL's #2 and #3, only the 'Checking URL....' and 'End > of validation' messages. Your are missing the "puts" before the "URL # does not validate" > -- > Posted viahttp://www.ruby-forum.com/.