0
我已經下載了Minimalexample.Offscreen的示例 這是我使用截圖的代碼,但我沒有得到整個頁面。圖像被裁切(唯一可見的頁面截圖取)全屏幕截圖與Cefsharp c#
// c# code
var scriptTask = browser.EvaluateScriptAsync("document.getElementById('lst-ib').value = 'CefSharp Was Here!'");
scriptTask.ContinueWith(t =>
{
Thread.Sleep(500);
var task = browser.ScreenshotAsync();
task.ContinueWith(x =>
{
var screenshotPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "CefSharp screenshot.png");
Console.WriteLine();
Console.WriteLine("Screenshot ready. Saving to {0}", screenshotPath);
task.Result.Save(screenshotPath);
task.Result.Dispose();
Console.WriteLine("Screenshot saved. Launching your default image viewer...");
Process.Start(screenshotPath);
Console.WriteLine("Image viewer launched. Press any key to exit.");
}, TaskScheduler.Default);
}).Wait();
我怎樣才能得到充分的長頁面截圖與CefSharp屏幕外或Cefsharp的WinForms?
爲什麼不使用'async/await'?沒有支持.NET版本的任務,但沒有'async/await'(提示)。這會使你的代碼變得更清潔並避免由於錯過Dispose調用而導致的泄漏。正如[此討論顯示](https://github.com/cefsharp/CefSharp/issues/957),您的頁面可能尚未完全加載,因此'ScreenshotAsync'只能捕獲第一幀 –
您可以給出任何演示代碼示例沒有其他功能的屏幕截圖只有screenshotasync可用 – skhurams
現在我已經更新了我的代碼,並添加了等待,但仍然是同樣的問題 – skhurams