-->

Create screenshot of the page with Watin-like tool

2019-04-11 19:29发布

问题:

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?

回答1:

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



回答2:

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.



回答3:

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).



回答4:

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.



标签: testing watin