C# WatiN cannot capture webpage to file
i'm getting error message when trying to capture web page. On my computer it works well but at my work it doesn't. Here is error http://imageshack.us/photo/my-images/717/asdasfrfdf.jpg/ I'm using common code browser.CaptureWebPageToFile(address). C开发者_如何转开发an anybody give me some suggestions? Thanks
I had a similar issue a while back. Give this a go: -
using WatiN.Core.UtilityClasses;
...
string fName = @"C:\test.jpg";
using (FileStream fStr = new FileStream(fName, FileMode.Create, FileAccess.Write, FileShare.None))
{
CaptureWebPage cwp = new CaptureWebPage(browser.DomContainer);
cwp.CaptureWebPageToFile(fStr, CaptureWebPage.ImageCodecs.Jpeg, true, false, 100, 100);
fStr.Close();
}
精彩评论