Hi,

I am currently testing a web app that depends on some sort of
webservice to be running in the background and i find the web service
goes into an unavailable state frequent, so i thought it was best i
use watir page checkers so that as soon as the page under test is
loaded, i can check for either 4xx or 5xx errors and the test should
just stop and not continue.

This is what i have done

def navigate(page_name)
  begin
    browser.goto("http://www.xxxxxx.com";)
    browser.check_for_http_error # will throw Exception
  end
  rescue Watir::Exception::NavigationException => e #catch the
Exception
    puts "Page did not load: #{e}" # => 'Cannot find server or DNS
Error'
end

I have a test structured in way that

1. The navigate method is called
2. Then some other checks is done on the page

What i expect is that the tests should terminate at line 1 , and give
an error message  'Cannot find server or DNS Error'

But this doesnt work, the test continue to line 2 to do some
assertions which then fails but i would love to be able to catch the
error at line 1.

I have also tried

def navigate(page_name)
   browser.add_checker(PageCheckers::NAVIGATION_CHECKER)
begin
    browser.goto("http://www.xxxxxx.com";)
  end
  rescue Watir::Exception::NavigationException => e #catch the
Exception
    puts "Page did not load: #{e}" # => 'Cannot find server or DNS
Error'
end

And i also tried excuting the code in irb, it prints "false" to
screen, I would appreciate any help

-- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to [email protected]
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/watir-general

Reply via email to