Doubt regarding Exception handling in Watir

  • Thread starter Simbolla Simbolla
  • Start date
S

Simbolla Simbolla

Hi all,

below is my code
def gotourl(url)
begin
$ie.goto(url)
rescue Watir::Exception::NavigationException => e
puts "navigation error"
printscreen(url)
end
end

1.in IE 8.0 version i get this error message when i navigate to invalid
URL "Internet Explorer cannot display the webpage"

my doubt is why rescue part is not executing for this error.

2.i want to know is it possible to use only "Watir::Exception" in my
rescue portion some thing this like this.

def gotourl(url)
begin
$ie.goto(url)
rescue Watir::Exception => e
puts "navigation error"
printscreen(url)
end
end

def clickbutton()
begin
$ie.button:)name,'btnGs').flash
rescue Watir::Exception => e # instead of
Watir::Exception::UnknownObjectException
puts "object not found error"
printscreen($ie.title)
end
end

3. What is the best of Exception handling in watir?
Please some body give me the best approach to do Exception handling
in watir
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top