4

I already save my screenshots of the entire page using this command successfully:

@browser.screenshot.save "html-report/#{screenshot_name}"

However, the screen has changed and now it contains an internal div with scrolling, containing the crucial information that I want to capture.

Instead of using the command above to capture the whole page, is there a way to capture just the all contents of this scrolling div?

Thank you!

Matheus Felipe
  • 2,482
  • 25
  • 24
  • 2
    Do you really need a screenshot of div's contents? What about just taking the text or html of the div? – Justin Ko Jun 19 '14 at 02:11
  • That's actually a good idea. However this DIV is actually a sale receipt so it would be interesting to have the "real" thing screenshotted. In any case I will talk to the business people and see if that's enough. Thanks for the idea! – Matheus Felipe Jun 19 '14 at 19:00
  • @JustinKo can you put in answer what you suggestin? – paul Jan 27 '15 at 10:53
  • @paul, the suggestion would not really answer the question. If you are looking for a code example, it would have just been `@browser.div.text` or `@browser.div.html`. – Justin Ko Jan 27 '15 at 13:51
  • possible duplicate of [How to capture the screenshot of only a specific element using Selenium Webdriver?](http://stackoverflow.com/questions/13832322/how-to-capture-the-screenshot-of-only-a-specific-element-using-selenium-webdrive) – djangofan Mar 18 '15 at 22:25

1 Answers1

3

Already implemented as watir plugin https://github.com/ansoni/watir-extensions-element-screenshot

Stan E
  • 3,396
  • 20
  • 31