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

# Save screenshot to file 'screenshot.png'

# Represent screenshot as PNG image string

# Represent screenshot as Base64 encoded string

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| 'screenshot.png'
  embed 'screenshot.png', 'image/png'

Last Updated: August 03, 2018