On 10.05.2011 19:32, TJ Wilkes wrote:
> Hi I've been learning Ruby to help with scripting some tests, but the
> books I have are only using mathematical method/class creations and my
> attempts to make my own methods are failing.  Looking for some help with
> the creation of two time savers.
>
> Note: Using ruby 1.8.7 and Watir-webdriver as well as IE 9.
>
> I'm trying to set up some page validation scripts but every attempt has
> failed, these run prefectly fine in the program if I repeat them and
> fill in linkX and PagetextX with specfics each time but i'd prefer to be
> able to run each with a simple bit of code calling the function.
> Such as: verify.LinkX("Terms")or verify.LinkX(href/ID/etc, "Terms")
> #which would validate a link called Terms.
> and verify.PagetextX("Your info is important").
>
> Thanks for any help or direction,

Sorry, I can't help you with Watir, but: do you really need to automate 
a Browser for this?  It seems for simple validation of page content you 
could as well read pages (e.g. with net/http or more sophisticated 
tools) and process the content (e.g. with Nokogiri).

If your server delivers different pages based on browser type you can 
send the appropriate HTTP header to make it believe you are IE 9.

Of course, if you intend to also evaluate JavaScript in pages etc. then 
your approach is better.  In that case maybe you also want to look at
http://wiki.openqa.org/display/WTR/XPath

Kind regards

	robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/