On Fri, Jun 5, 2009 at 2:33 PM, ash ashbr...@gmail.com wrote:
What I need is a way of clicking each link on a page to ensure they
don't error.
I would do it something like this (not tested):
browser.links.each do |link|
browser.goto link
# check if page is ok
browser.back
end
Željko
--
Hello,
The code posted by Željko will work only if all your links are absolute.
Try this:
require rubygems
require watir
$browser = Watir::Browser.new
$browser.goto http://www.google.com;
$links = Array.new
$browser.links.each do |l|
#Relative link
if (l.href.first == /)
$url
Thanks for that Felipe.
As far as validation goes I think my only option is to check that
pages visited are not error pages; maybe checking for existnce of
page cannot be found text.
On Jun 5, 2:48 pm, Felipe Knorr Kuhn fkn...@gmail.com wrote:
Hello,
The code posted by Željko will work only
Ash,
If you don't need to be authenticated in the app, this thread might help
you:
http://groups.google.com/group/watir-general/browse_thread/thread/26486904e89340b7?pli=1
Checking for the response code of the server is more reliable than looking
for some text :)
FK
2009/6/5 ash
Again, thanks Felipe.
Looks like the solution I need.
I will report back when I have had a chance to script and test.
Cheers...Ash
On Jun 5, 3:25 pm, Felipe Knorr Kuhn fkn...@gmail.com wrote:
Ash,
If you don't need to be authenticated in the app, this thread might help
you:
if it's not specific to your company, I think a script like this would
make an EXCELLENT addition to the examples in the Watir Wiki. I'd
like to strongly encourage you to consider 'sanitizing' what you end
up with (removing any company specific stuff) and posting it as an
watir code example