Screenshots

Watir-WebDriver has a pretty awesome screenshot capability, built right in.

browser.driver.save_screenshot 'screenshot.png'

The great thing about this is it gives you a screen shot of the entire page, not just above the fold.

If you’re using Cucumber also, you can easily embed this in your html report output by adding the following to your env.rb file:

  After do |scenario|
    browser.driver.save_screenshot 'screenshot.png'
    embed 'screenshot.png', 'image/png'
  end