3

I need to create a screenshot of the page by providing a page URL to the command line tool. I found the following application: Convert HTML To Image. This tool is OK but want a more flexible application. I need to have ability to perform the following:

  1. Go to the following page.
  2. Click button.
  3. Take a screenshot and save it.

I want to create an application that will test a site by going by URL, take a shots, and then send the images to the email.

Does anybody has an experience in solving such problems?

4 Answers4

11

Watin can capture screenshots:

ie.CaptureWebPageToFile("c:\tmp\watin main page.jpg");

More info:

http://watin.sourceforge.net/releasenotes-1-2-0-4000.html http://fwdnug.com/blogs/ddodgen/archive/2008/06/19/watin-api-capturewebpagetofile.aspx

Brian Low
  • 11,605
  • 4
  • 58
  • 63
  • 1
    As of my research right now, this only works with IE7 - Firefox and other IE versions all have odd errors. – Robert P Sep 15 '09 at 23:47
  • I just tested with IE9 - and this seems to work. I recommend this as the answer to be accepted. – Adam Nov 18 '11 at 16:58
1

I am a contributor to the WatiN project and the author of the WatiN Test Recorder. To do what you want, I'd suggest using something like csExWB2 (http://code.google.com/p/csexwb2/). The demo will give you the basic browser, and you can add screen shots where you like. Emailing is not covered, but that should be fairly easy.

  • This answer seems pretty old - would you still recommend this approach? – Adam Nov 18 '11 at 16:59
  • Also - are you implying that you would NOT use WatiN to accomplish this? You would use the separate web browser control? Or you are implying to use WatiN to automate this 3rd party webbrowser control? – Adam Nov 18 '11 at 17:00
1

I know this is very old post but i want to leave a message for visitor of this post. PhantomJS is one option (http://www.phantomjs.org).

Jenga Blocks
  • 121
  • 1
  • 2
  • 9
0

According to the WatiN features page:

  • Supports creating screenshots of webpages

I would direct you to more specifical documentation, but the documentation web doesn't work well with Firefox, so I can't search it.

Gonzalo Quero
  • 3,303
  • 18
  • 23