开发者

C# WatiN cannot capture webpage to file

开发者 https://www.devze.com 2023-03-30 10:04 出处:网络
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 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();
}
0

精彩评论

暂无评论...
验证码 换一张
取 消