3

I am looking for a way to save a screenshot of an element of a web page when I run acceptance tests. Is this possible with Capybara or another tool with RSpec/Cucumber tests?

Valentino Ru
  • 4,964
  • 12
  • 43
  • 78
TheFooProgrammer
  • 2,439
  • 5
  • 28
  • 43

2 Answers2

2

Take a look at phantomjs.

and this question with how to grab only part of the screen.

How to render part of a page with PhantomJS?

Community
  • 1
  • 1
Doon
  • 19,719
  • 3
  • 40
  • 44
  • Thanks for the link, but one problem with PhantomJS is that it might not be as up-to-date as the Chrome version I am testing against. Also I ideally want to capture screen shots in multiple browsers: Firefox, Chrome, and Safari. In the future I might add IE 10 and Opera to the list too. – TheFooProgrammer Dec 03 '12 at 14:26
0

Taking a screen shot is very easy with Capybara.

http://www.opinionatedprogrammer.com/2012/01/screenshots-with-capybara-selenium/

However I don't believe there is any current implementation of screenshots that can cherry pick a certain element on the page.

stuartc
  • 2,244
  • 2
  • 24
  • 31