You could do it a couple of ways.

1. Use an if/else statement (as seen here -

if condition=true
   # log pass
   # log fail

2. Use the Exception class:

Here's the basic syntax:

  # do something
  # log the failure if it fails.

For more detailed info, I'd strongly suggest getting familiar with


On Feb 4, 8:55 am, tester86 <> wrote:
> Hi
> Question for the watir group. When I run my test sometimes it fails if
> it cannot find an element or input field. Is there a way that when
> this occurs it can log that failure and continue running the tests and
> not stop. Is there any Watir commands that I can put in place at
> points in my script to cope with failures?
> I am using the ruby logger to output all my result into a text file.

You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to
Before posting, please read the following guidelines:
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to